mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix reference handle
This commit is contained in:
1 parent
4aa689b508
commit
628ec7953b
3 files changed
+3
-3
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user