Chore: copy PDFs on disk instead of reading them into memory (#14882)

This commit is contained in:
Trenton H authored and GitHub committed 2026-11-26 23:24:20 +00:00
1 parent 5c399653d7
commit b471679469
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -566,7 +566,7 @@ class MailDocumentParser:
# If no HTML content, create the PDF from the message.
# Otherwise, create 2 PDFs and merge them with Gotenberg.
if not mail_message.html:
archive_path.write_bytes(mail_pdf_file.read_bytes())
shutil.copyfile(mail_pdf_file, archive_path)
else:
pdf_of_html_content = self.generate_pdf_from_html(
mail_message.html,
+1 -1
View File
@@ -443,7 +443,7 @@ class RasterisedDocumentParser:
self.log.warning(
f"PDF/A metadata stamping failed ({e!s}); falling back to plain PDF.",
)
pdfa_path.write_bytes(plain_pdf_path.read_bytes())
shutil.copyfile(plain_pdf_path, pdfa_path)
return pdfa_path