From 83c04e6399581e76544fb19a98002c7e8914906d Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 4 Apr 2026 01:59:57 -0700 Subject: [PATCH] Update GS JPEG corruption warning for 10.7.0+ The JPEG truncation bug (1-15 bytes) persists in Ghostscript 10.7.0. Update the warning message to show the actual GS version instead of hardcoding "10.6.x", and remove the stale date reference. Also make the test warning filter match the new message format. --- src/ocrmypdf/builtin_plugins/ghostscript.py | 8 ++++---- tests/conftest.py | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ocrmypdf/builtin_plugins/ghostscript.py b/src/ocrmypdf/builtin_plugins/ghostscript.py index 110e6983..46b5e331 100644 --- a/src/ocrmypdf/builtin_plugins/ghostscript.py +++ b/src/ocrmypdf/builtin_plugins/ghostscript.py @@ -131,10 +131,10 @@ def check_options(options): ) if gs_version >= Version('10.6.0'): log.warning( - "Ghostscript 10.6.x contains JPEG encoding errors that may corrupt " - "images. OCRmyPDF will attempt to mitigate, but this version is " - "strongly not recommended. Please upgrade to a newer version. " - "As of 2025-12, 10.6.0 is the latest version of Ghostscript." + "Ghostscript %s contains JPEG encoding errors that may corrupt " + "images. OCRmyPDF will attempt to mitigate, but versions 10.6.0+ " + "are strongly not recommended until this is fixed upstream.", + gs_version, ) if options.output_type == 'pdfa': options.output_type = 'pdfa-2' diff --git a/tests/conftest.py b/tests/conftest.py index 472aaee0..f3abe5d3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,14 +19,11 @@ from ocrmypdf.exceptions import ExitCode class Gs106WarningFilter(logging.Filter): - """Filter out expected Ghostscript 10.6.x warning from test logs.""" + """Filter out expected Ghostscript 10.6+ JPEG encoding warning from test logs.""" def filter(self, record: logging.LogRecord) -> bool: - # Allow all records except the expected Ghostscript 10.6.x warning - return ( - "Ghostscript 10.6.x contains JPEG encoding errors" - not in record.getMessage() - ) + # Allow all records except the expected Ghostscript 10.6+ warning + return "contains JPEG encoding errors" not in record.getMessage() @pytest.fixture(autouse=True)