mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
added checksums for archived documents.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import hashlib
|
||||
import multiprocessing
|
||||
|
||||
import ocrmypdf
|
||||
@@ -27,6 +28,8 @@ def handle_document(document):
|
||||
parser.parse(document.source_path, mime_type)
|
||||
if parser.get_archive_path():
|
||||
shutil.copy(parser.get_archive_path(), document.archive_path)
|
||||
with document.archive_file as f:
|
||||
document.archive_checksum = hashlib.md5(f.read()).hexdigest()
|
||||
else:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"Parser {parser} did not produce an archived document "
|
||||
@@ -35,7 +38,7 @@ def handle_document(document):
|
||||
|
||||
if parser.get_text():
|
||||
document.content = parser.get_text()
|
||||
document.save()
|
||||
document.save()
|
||||
|
||||
parser.cleanup()
|
||||
|
||||
|
Reference in New Issue
Block a user