From 64df4439d352270037cca971d7bd5cad51fb8e79 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Jun 2026 20:16:06 -0400 Subject: [PATCH] fix tests --- apps/api/src/http/upload/index.ts | 2 +- apps/api/src/http/upload/upload.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/http/upload/index.ts b/apps/api/src/http/upload/index.ts index 43d08d7..dc82936 100644 --- a/apps/api/src/http/upload/index.ts +++ b/apps/api/src/http/upload/index.ts @@ -49,7 +49,7 @@ export function detectImageType(buffer: Buffer): DetectedFile | null { function assertSafeImageContent(file: Express.Multer.File) { const detected = detectImageType(file.buffer) if (!detected || !ALLOWED_IMAGE_TYPES.has(detected.mime)) { - throw new ValidationError('Unsupported or spoofed image file') + throw new ValidationError(`Unsupported or spoofed image file: ${file.name}`) } if (file.mimetype !== detected.mime) { diff --git a/apps/api/src/http/upload/upload.test.ts b/apps/api/src/http/upload/upload.test.ts index f3cbfb2..ca04d64 100644 --- a/apps/api/src/http/upload/upload.test.ts +++ b/apps/api/src/http/upload/upload.test.ts @@ -36,6 +36,6 @@ describe('upload assertions', () => { expect(() => assertImageFiles([ file({ originalname: 'front.png', mimetype: 'image/png', buffer: Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]) }), file({ originalname: 'report.pdf', mimetype: 'application/pdf', buffer: Buffer.from('%PDF') }), - ])).toThrow('Unsupported or spoofed image file') + ])).toThrow(`Unsupported or spoofed image file: ${overrides.name}`) }) })