diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index bc93c2bea..e778d188c 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.33.2", + "version": "2.33.3", "bin": "bin/hydrooj.js", "main": "src/loader", "module": "src/loader", diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 04d81c2b9..f5ec44b25 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -325,10 +325,10 @@ export class ContestProblemFileDownloadHandler extends ContestProblemHandler { ); return; } - this.response.etag = file.etag; const type = lookup(filename).toString(); const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => type.includes(i)).length; if (shouldProxy && file.size! < 32 * 1024 * 1024) { + this.response.etag = file.etag; this.response.body = await storage.get(target); this.response.type = file['Content-Type'] || type; this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`; diff --git a/packages/hydrooj/src/handler/homework.ts b/packages/hydrooj/src/handler/homework.ts index 5dfa00bd3..b8a314c41 100644 --- a/packages/hydrooj/src/handler/homework.ts +++ b/packages/hydrooj/src/handler/homework.ts @@ -190,10 +190,10 @@ export class HomeworkProblemFileDownloadHandler extends HomeworkDetailProblemHan ); return; } - this.response.etag = file.etag; const type = lookup(filename).toString(); const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => type.includes(i)).length; if (shouldProxy && file.size! < 32 * 1024 * 1024) { + this.response.etag = file.etag; this.response.body = await storage.get(target); this.response.type = file['Content-Type'] || type; this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`; diff --git a/packages/hydrooj/src/handler/misc.ts b/packages/hydrooj/src/handler/misc.ts index ad6cae9b3..2df5a00ce 100644 --- a/packages/hydrooj/src/handler/misc.ts +++ b/packages/hydrooj/src/handler/misc.ts @@ -116,10 +116,10 @@ export class FSDownloadHandler extends Handler { ); return; } - this.response.etag = file.etag; const type = lookup(filename).toString(); const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => type.includes(i)).length; if (shouldProxy && file.size! < 32 * 1024 * 1024) { + this.response.etag = file.etag; this.response.body = await storage.get(target); this.response.type = file['Content-Type'] || type; this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`; diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index de3f495a8..b848a118a 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -424,10 +424,10 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler { ); return; } - this.response.etag = file.etag; const fileType = lookup(filename).toString(); const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => fileType.includes(i)).length; if (shouldProxy && file.size! < 32 * 1024 * 1024) { + this.response.etag = file.etag; this.response.body = await storage.get(target); this.response.type = file['Content-Type'] || fileType; this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;