From 624760c6ba817b97da3c9d00742a2afd03ce5305 Mon Sep 17 00:00:00 2001 From: aradhyacp Date: Sat, 10 Jan 2026 01:23:23 +0530 Subject: [PATCH 1/3] Fix typo in recovered image filename generation --- aperisolve/analyzers/pcrt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aperisolve/analyzers/pcrt.py b/aperisolve/analyzers/pcrt.py index a318bad..5fae7bb 100644 --- a/aperisolve/analyzers/pcrt.py +++ b/aperisolve/analyzers/pcrt.py @@ -18,7 +18,7 @@ class PCRTAnalyzer(SubprocessAnalyzer): def _write_repaired_data(self, data: bytes) -> str: """Write recovered image.""" - img_name = f"pcrt_recoverd_{self.input_img.name}.png" + img_name = f"pcrt_recoverd_{self.input_img.stem}.png" output_path = self.output_dir / img_name saved_img_url = "/image/" + str(Path(self.output_dir.name) / img_name) with output_path.open("wb") as f: From 05782b710ad18e4e8cfaf4c868692775fd1815e0 Mon Sep 17 00:00:00 2001 From: aradhyacp Date: Sat, 10 Jan 2026 01:23:31 +0530 Subject: [PATCH 2/3] Fix IHDR chunk extraction to return only the chunk itself --- aperisolve/utils/png.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aperisolve/utils/png.py b/aperisolve/utils/png.py index ff319c7..05fd1fb 100644 --- a/aperisolve/utils/png.py +++ b/aperisolve/utils/png.py @@ -57,8 +57,9 @@ class PNG: pos = data.find(b"IHDR") if pos == -1: return -1, b"" - idat_begin = data.find(b"IDAT") - return pos, data[pos - 4 : idat_begin - 4 if idat_begin != -1 else pos + 21] + # IHDR chunk is always 25 bytes: 4 (length) + 4 (type) + 13 (data) + 4 (CRC) + # Only return the IHDR chunk itself, not everything up to IDAT + return pos, data[pos - 4 : pos + 21] def check_header(self) -> bool: """Check and fix PNG header.""" From 75ad5916afd9e47c8307c65c86eaaea3979e6e1a Mon Sep 17 00:00:00 2001 From: Zeecka <24873615+Zeecka@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:10:55 +0100 Subject: [PATCH 3/3] Update aperisolve/analyzers/pcrt.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- aperisolve/analyzers/pcrt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aperisolve/analyzers/pcrt.py b/aperisolve/analyzers/pcrt.py index 5fae7bb..10a7f37 100644 --- a/aperisolve/analyzers/pcrt.py +++ b/aperisolve/analyzers/pcrt.py @@ -18,7 +18,7 @@ class PCRTAnalyzer(SubprocessAnalyzer): def _write_repaired_data(self, data: bytes) -> str: """Write recovered image.""" - img_name = f"pcrt_recoverd_{self.input_img.stem}.png" + img_name = f"pcrt_recovered_{self.input_img.stem}.png" output_path = self.output_dir / img_name saved_img_url = "/image/" + str(Path(self.output_dir.name) / img_name) with output_path.open("wb") as f: