diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 9ee1f5693..ba409b278 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -304,7 +304,7 @@ export class ContestProblemFileDownloadHandler extends ContestProblemHandler { async get(domainId: string, filename: string, noDisposition = false) { if (this.pdoc.reference) { this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid); - if (!this.pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid); + if (!this.pdoc) throw new ProblemNotFoundError(); } const target = `problem/${this.pdoc.domainId}/${this.pdoc.docId}/additional_file/${filename}`; const file = await storage.getMeta(target); diff --git a/packages/hydrooj/src/handler/homework.ts b/packages/hydrooj/src/handler/homework.ts index 639e424ea..ea0426a47 100644 --- a/packages/hydrooj/src/handler/homework.ts +++ b/packages/hydrooj/src/handler/homework.ts @@ -175,7 +175,7 @@ export class HomeworkProblemFileDownloadHandler extends HomeworkDetailProblemHan async get(domainId: string, filename: string, noDisposition = false) { if (this.pdoc.reference) { this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid); - if (!this.pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid); + if (!this.pdoc) throw new ProblemNotFoundError(); } const target = `problem/${this.pdoc.domainId}/${this.pdoc.docId}/additional_file/${filename}`; const file = await storage.getMeta(target); diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 56e1759ee..790afce6b 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -490,7 +490,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler { if (this.pdoc.reference) { if (type === 'testdata') throw new ForbiddenError('Cannot download testdata'); this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid); - if (!this.pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid); + if (!this.pdoc) throw new ProblemNotFoundError(); } if (type === 'testdata' && !this.user.own(this.pdoc)) { if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);