diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index ff434890f..7291d349e 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "4.2.2", + "version": "4.2.3", "bin": "bin/hydrooj.js", "main": "src/plugin-api", "module": "src/plugin-api", diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index dc7d7e367..473c4406b 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -484,6 +484,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler { @param('tid', Types.ObjectID, true) async prepare(domainId: string, tid?: ObjectID) { if (tid && !contest.isOngoing(this.tdoc, this.tsdoc)) throw new ContestNotLiveError(this.tdoc.docId); + if (typeof this.pdoc.config === 'string') throw new BadRequestError('Invalid problem config'); } async get() { diff --git a/packages/hydrooj/src/model/contest.ts b/packages/hydrooj/src/model/contest.ts index f5da5ac81..63a779d50 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -130,9 +130,9 @@ const acm = buildContestRule({ ]; if (isExport) { row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school }); - row.push({ type: 'string', value: udoc.displayName }); - row.push({ type: 'string', value: udoc.studentId }); + row.push({ type: 'string', value: udoc.school || '' }); + row.push({ type: 'string', value: udoc.displayName || '' }); + row.push({ type: 'string', value: udoc.studentId || '' }); } row.push({ type: 'time', @@ -260,9 +260,9 @@ const oi = buildContestRule({ ]; if (isExport) { row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school }); - row.push({ type: 'string', value: udoc.displayName }); - row.push({ type: 'string', value: udoc.studentId }); + row.push({ type: 'string', value: udoc.school || '' }); + row.push({ type: 'string', value: udoc.displayName || '' }); + row.push({ type: 'string', value: udoc.studentId || '' }); } row.push({ type: 'total_score', value: tsdoc.score || 0 }); for (const pid of tdoc.pids) { diff --git a/packages/hydrooj/src/model/setting.ts b/packages/hydrooj/src/model/setting.ts index 115c67490..6b3734716 100644 --- a/packages/hydrooj/src/model/setting.ts +++ b/packages/hydrooj/src/model/setting.ts @@ -164,7 +164,7 @@ DomainSetting( ); DomainUserSetting( - Setting('setting_info', 'displayName', null, 'text', 'Display Name'), + Setting('setting_info', 'displayName', '', 'text', 'Display Name'), Setting('setting_storage', 'nAccept', 0, 'number', 'nAccept', null, FLAG_HIDDEN | FLAG_DISABLED), Setting('setting_storage', 'nSubmit', 0, 'number', 'nSubmit', null, FLAG_HIDDEN | FLAG_DISABLED), Setting('setting_storage', 'nLike', 0, 'number', 'nLike', null, FLAG_HIDDEN | FLAG_DISABLED),