core: allow empty pretest input

This commit is contained in:
undefined committed 2025-12-28 14:16:33 +08:00
1 parent 5f38d63866
commit 92e42db7b5
2 files changed
+13 -12

No files matched your search

+2 -1
View File
@@ -483,7 +483,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
@param('lang', Types.Name)
@param('code', Types.String, true)
@param('pretest', Types.Boolean)
@param('input', Types.ArrayOf(Types.String), true)
@param('input', Types.ArrayOf(Types.String, true), true)
@param('tid', Types.ObjectId, true)
async post(domainId: string, lang: string, code: string, pretest = false, input: string[] = [], tid?: ObjectId) {
const config = this.pdoc.config;
@@ -499,6 +499,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
throw new ProblemNotAllowPretestError('type');
}
if (!input.length) throw new ValidationError('input');
input = input.map((i) => i || '');
}
await this.limitRate('add_record', 60, system.get('limit.submission_user'), '{{user}}');
await this.limitRate('add_record', 60, pretest ? system.get('limit.pretest') : system.get('limit.submission'));