Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:files): throw consistent error for unsafe filenames in unzip tests

johavena0652de9b30d
diff --git a/backend/src/applications/files/utils/unzip-file.spec.ts b/backend/src/applications/files/utils/unzip-file.spec.ts
index 65aae00b..ef302743 100644
--- a/backend/src/applications/files/utils/unzip-file.spec.ts
+++ b/backend/src/applications/files/utils/unzip-file.spec.ts
@@ -57,7 +57,7 @@ describe(extractZip.name, () => {
await writeFile(archivePath, createZip('..\\zip-slip-proof.txt'))
- await expect(extractZip(archivePath, outputDir)).rejects.toThrow('invalid relative path: ../zip-slip-proof.txt')
+ await expect(extractZip(archivePath, outputDir)).rejects.toThrow(ERR_UNSAFE_FILENAME)
await expect(access(escapedPath)).rejects.toMatchObject({ code: 'ENOENT' })
await writeFile(archivePath, createZip('link', Buffer.from('../../outside'), 0o120777))