From 5d95ed45031ca67e8411eaf17c3ebb0e39ad5a5a Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Mon, 12 Feb 2024 20:29:52 +1300 Subject: [PATCH] Get correct checksum for attachments --- weasyprint/pdf/anchors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weasyprint/pdf/anchors.py b/weasyprint/pdf/anchors.py index 9c270a718..4df9fe0d6 100644 --- a/weasyprint/pdf/anchors.py +++ b/weasyprint/pdf/anchors.py @@ -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.