mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: FSDownload: capture invalid path error
This commit is contained in:
1 parent
9672436151
commit
4930220fca
1 file changed
+8
-3
@@ -96,9 +96,14 @@ export class FSDownloadHandler extends Handler {
|
|||||||
target,
|
target,
|
||||||
size: file?.size || 0,
|
size: file?.size || 0,
|
||||||
});
|
});
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
try {
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user