From 932b3af935652f734047f7b5960645a68527f133 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Mon, 31 Mar 2025 11:44:30 +0200 Subject: [PATCH] add test that would have highlighted #189 --- src/strass/strass_app/tests/test_sanitize_pdf.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/strass/strass_app/tests/test_sanitize_pdf.py b/src/strass/strass_app/tests/test_sanitize_pdf.py index fab61988..453bd7ef 100644 --- a/src/strass/strass_app/tests/test_sanitize_pdf.py +++ b/src/strass/strass_app/tests/test_sanitize_pdf.py @@ -1,5 +1,7 @@ import os -from io import StringIO +from io import BytesIO + +from pypdf import PdfWriter from strass_app import utils from strass_app.tests.test_base_test_case import TooledTestCase @@ -21,3 +23,11 @@ class SafePDFTestCase(TooledTestCase): cv.seek(0) my_io = utils.safe_pdf(cv) self.check_no_js(my_io) + + def test_binary_file_indirect_object_iter(self): + writer = PdfWriter() + writer.add_attachment("test.txt", b"content") + stream = BytesIO() + writer.write(stream) + my_io = utils.safe_pdf(stream) + self.check_no_js(my_io) -- GitLab