mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
md5: centralize and deduplicate (#11003)
Document partial md5 hash is calculated by util.partialMD5() and stored in doc_settings as "partial_md5_checksum" on the first document opening.
This commit is contained in:
@@ -335,6 +335,15 @@ describe("util module", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("partialMD5()", function()
|
||||
it("should calculate partial md5 hash of pdf file", function()
|
||||
assert.is_equal(util.partialMD5("spec/front/unit/data/tall.pdf"), "41cce710f34e5ec21315e19c99821415")
|
||||
end)
|
||||
it("should calculate partial md5 hash of epub file", function()
|
||||
assert.is_equal(util.partialMD5("spec/front/unit/data/leaves.epub"), "59d481d168cca6267322f150c5f6a2a3")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("fixUtf8()", function()
|
||||
it("should replace invalid UTF-8 characters with an underscore", function()
|
||||
assert.is_equal("\127 _ _\127 ", util.fixUtf8("\127 \128 \194\127 ", "_"))
|
||||
|
||||
Reference in New Issue
Block a user