From b540ab447bf837ebfbd9c015a80dcefbbc7cd29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Alves?= Date: Thu, 22 Oct 2026 21:27:50 +0100 Subject: [PATCH] fix(archive): classify libvips sequential-JPEG SOS errors as corrupt source (BIT-31700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VipsJpeg: Invalid SOS parameters for sequential JPEG is another shape of the same truncated/corrupted cloud-archive JPEG that premature end and corrupt header already cover; isCorruptSourceMessage didn't match it, so it fell through to the generic failure path and reached the error hub as a warning instead of being marked corrupt_source at info level. Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8) Paperclip-Issue: BIT-31700 Paperclip-Run: 6435a4c4-0daa-41c4-8641-a0431c981ee8 --- apps/api/src/archive/corrupt-source.test.ts | 1 + apps/api/src/archive/corrupt-source.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/archive/corrupt-source.test.ts b/apps/api/src/archive/corrupt-source.test.ts index 000f6b9..dbf997e 100644 --- a/apps/api/src/archive/corrupt-source.test.ts +++ b/apps/api/src/archive/corrupt-source.test.ts @@ -26,6 +26,7 @@ describe("corrupt / incomplete archive sources (BIT-31621)", () => { expect(isCorruptSourceMessage("premature end of JPEG")).toBe(true); expect(isCorruptSourceMessage("Input file contains unsupported image format")).toBe(true); expect(isCorruptSourceMessage("VipsForeignLoad: \"/tmp/x/original.jpg\" is not a known file format")).toBe(true); + expect(isCorruptSourceMessage("VipsJpeg: Invalid SOS parameters for sequential JPEG")).toBe(true); expect(isCorruptSourceMessage("ffmpeg exited 234: Stream map '0:v:0' matches no streams")).toBe(false); expect(isCorruptSourceMessage("GET /a failed: 503")).toBe(false); }); diff --git a/apps/api/src/archive/corrupt-source.ts b/apps/api/src/archive/corrupt-source.ts index 9614c78..ade5413 100644 --- a/apps/api/src/archive/corrupt-source.ts +++ b/apps/api/src/archive/corrupt-source.ts @@ -24,7 +24,7 @@ export class IncompleteDownload extends Error { /** ffprobe/ffmpeg/sharp messages that mean the cloud file itself is damaged, not our pipeline. */ export function isCorruptSourceMessage(message: string): boolean { - return /moov atom not found|premature end|not a known file format|corrupt (?:jpeg )?header|Corrupt JPEG|Input file has corrupt header|Input file contains unsupported image format|unsupported image format|Invalid data found when processing input/i.test( + return /moov atom not found|premature end|not a known file format|corrupt (?:jpeg )?header|Corrupt JPEG|Input file has corrupt header|Input file contains unsupported image format|unsupported image format|Invalid data found when processing input|Invalid SOS parameters/i.test( message, ); } -- 2.47.3