core: generate: fix contest not found error

This commit is contained in:
undefined committed 2023-12-25 04:51:31 +08:00
1 parent c92544bec7
commit 31a9baa3c4
1 file changed
+1 -1
+1 -1
View File
@@ -157,7 +157,7 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
async get(domainId: string, rid: ObjectId, download = false) {
const rdoc = this.rdoc;
let canViewDetail = true;
if (rdoc.contest?.toString() === '000000000000000000000000') {
if (rdoc.contest?.toString().startsWith('0'.repeat(23))) {
if (rdoc.uid !== this.user._id) throw new PermissionError(PERM.PERM_READ_RECORD_CODE);
} else if (rdoc.contest) {
this.tdoc = await contest.get(domainId, rdoc.contest);