1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-09-17 15:37:34 +03:00

Merge pull request #2063 from kesara/fix/attachment-hash

Get correct checksum for attachments
This commit is contained in:
Guillaume Ayoub 2024-02-12 10:14:10 +01:00 committed by GitHub
commit f85a09eb10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -300,7 +300,7 @@ def write_pdf_attachment(pdf, attachment, compress):
except URLFetchingError as exception:
LOGGER.error('Failed to load attachment: %s', exception)
return
attachment.md5 = hashlib.md5(data).hexdigest()
attachment.md5 = hashlib.md5(stream).hexdigest()
# TODO: Use the result object from a URL fetch operation to provide more
# details on the possible filename and MIME type.