diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 3fc30ea3a..7be8f4cf9 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.25.3", + "version": "2.25.4", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index af855eb03..02df1b786 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -407,7 +407,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler { @post('filename', Types.Name, true) @post('type', Types.Range(['testdata', 'additional_file']), true) async postUploadFile(domainId: string, filename: string, type = 'testdata') { - if (this.pdoc.data.length + this.pdoc.additional_file.length >= system.get('limit.problem_files_max')) { + if ((this.pdoc.data?.length || 0) + (this.pdoc.additional_file?.length || 0) >= system.get('limit.problem_files_max')) { throw new ForbiddenError('File limit exceeded.'); } if (!this.request.files.file) throw new ValidationError('file');