From 81eb915c5bca9ce406e856453a236bc6c6c6f6e2 Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Fri, 1 Mar 2024 06:21:06 +0100 Subject: [PATCH 1/2] PDF generation: use blob file path, not file name attribute. syslabcom/scrum#1836 --- src/recensio/plone/browser/pdfgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/recensio/plone/browser/pdfgen.py b/src/recensio/plone/browser/pdfgen.py index 513b90f..a2968b1 100644 --- a/src/recensio/plone/browser/pdfgen.py +++ b/src/recensio/plone/browser/pdfgen.py @@ -174,7 +174,8 @@ def __call__(self): error_code = None new_path = None if pdf: - original = pdf.filename + with pdf.open() as blob_file: + original = blob_file.name fd, new_path = tempfile.mkstemp(prefix="final", suffix=".pdf") os.close(fd) # 2463 # nosec: bandit complains about the use of os.system (B605) From 59c867d5603da6bc08e45e9fd6a81c3fe8ee5c01 Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Fri, 1 Mar 2024 13:34:23 +0100 Subject: [PATCH 2/2] pdfgen: Add comment syslabcom/scrum#1836 Co-authored-by: Johannes Raggam --- src/recensio/plone/browser/pdfgen.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/recensio/plone/browser/pdfgen.py b/src/recensio/plone/browser/pdfgen.py index a2968b1..048d631 100644 --- a/src/recensio/plone/browser/pdfgen.py +++ b/src/recensio/plone/browser/pdfgen.py @@ -175,6 +175,7 @@ def __call__(self): new_path = None if pdf: with pdf.open() as blob_file: + # use blob file path original = blob_file.name fd, new_path = tempfile.mkstemp(prefix="final", suffix=".pdf") os.close(fd) # 2463