core: FSDownload: capture invalid path error

This commit is contained in:
undefined committed 2023-01-07 22:51:14 +08:00
1 parent 9672436151
commit 4930220fca
1 file changed
+8 -3
+8 -3
View File
@@ -96,9 +96,14 @@ export class FSDownloadHandler extends Handler {
target,
size: file?.size || 0,
});
this.response.redirect = await storage.signDownloadLink(
target, noDisposition ? undefined : filename, false, 'user',
);
try {
this.response.redirect = await storage.signDownloadLink(
target, noDisposition ? undefined : filename, false, 'user',
);
} catch (e) {
if (e.message.includes('Invalid path')) throw new NotFoundError(filename);
throw e;
}
}
}