mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: only add cache-control header if signLink success
This commit is contained in:
1 file changed
+1
-1
@@ -84,7 +84,6 @@ export class FSDownloadHandler extends Handler {
|
||||
@param('filename', Types.Filename)
|
||||
@param('noDisposition', Types.Boolean)
|
||||
async get(domainId: string, uid: number, filename: string, noDisposition = false) {
|
||||
this.response.addHeader('Cache-Control', 'public');
|
||||
const target = `user/${uid}/${filename}`;
|
||||
const file = await storage.getMeta(target);
|
||||
await oplog.log(this, 'download.file.user', {
|
||||
@@ -95,6 +94,7 @@ export class FSDownloadHandler extends Handler {
|
||||
this.response.redirect = await storage.signDownloadLink(
|
||||
target, noDisposition ? undefined : filename, false, 'user',
|
||||
);
|
||||
this.response.addHeader('Cache-Control', 'public');
|
||||
} catch (e) {
|
||||
if (e.message.includes('Invalid path')) throw new NotFoundError(filename);
|
||||
throw e;
|
||||
|
||||
Reference in new issue
Block a user