mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-01 01:46:16 +00:00
Use the original image file for the checksum, not the maybe alpha removed version (#4781)
This commit is contained in:
@@ -519,7 +519,11 @@ class Consumer(LoggingMixin):
|
||||
document.filename = generate_unique_filename(document)
|
||||
create_source_path_directory(document.source_path)
|
||||
|
||||
self._write(document.storage_type, self.path, document.source_path)
|
||||
self._write(
|
||||
document.storage_type,
|
||||
self.original_path,
|
||||
document.source_path,
|
||||
)
|
||||
|
||||
self._write(
|
||||
document.storage_type,
|
||||
@@ -711,21 +715,20 @@ class Consumer(LoggingMixin):
|
||||
|
||||
storage_type = Document.STORAGE_TYPE_UNENCRYPTED
|
||||
|
||||
with open(self.path, "rb") as f:
|
||||
document = Document.objects.create(
|
||||
title=(
|
||||
self._parse_title_placeholders(self.override_title)
|
||||
if self.override_title is not None
|
||||
else file_info.title
|
||||
)[:127],
|
||||
content=text,
|
||||
mime_type=mime_type,
|
||||
checksum=hashlib.md5(f.read()).hexdigest(),
|
||||
created=create_date,
|
||||
modified=create_date,
|
||||
storage_type=storage_type,
|
||||
original_filename=self.filename,
|
||||
)
|
||||
document = Document.objects.create(
|
||||
title=(
|
||||
self._parse_title_placeholders(self.override_title)
|
||||
if self.override_title is not None
|
||||
else file_info.title
|
||||
)[:127],
|
||||
content=text,
|
||||
mime_type=mime_type,
|
||||
checksum=hashlib.md5(self.original_path.read_bytes()).hexdigest(),
|
||||
created=create_date,
|
||||
modified=create_date,
|
||||
storage_type=storage_type,
|
||||
original_filename=self.filename,
|
||||
)
|
||||
|
||||
self.apply_overrides(document)
|
||||
|
||||
|
Reference in New Issue
Block a user