From 81995290fe07215b5e399436c2cbb03d2e78e11b Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 12 Feb 2025 10:35:03 +0800 Subject: [PATCH] core: use FileTooLargeError for ProblemSubmitHandler --- packages/hydrooj/src/handler/problem.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 567afc92c..fb414ad59 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -11,7 +11,7 @@ import { sortFiles, streamToBuffer } from '@hydrooj/utils/lib/utils'; import type { Context } from '../context'; import { BadRequestError, ContestNotAttendedError, ContestNotEndedError, ContestNotFoundError, ContestNotLiveError, - FileLimitExceededError, HackFailedError, NoProblemError, NotFoundError, + FileLimitExceededError, FileTooLargeError, HackFailedError, NoProblemError, NotFoundError, PermissionError, ProblemAlreadyExistError, ProblemAlreadyUsedByContestError, ProblemConfigError, ProblemIsReferencedError, ProblemNotAllowCopyError, ProblemNotAllowLanguageError, ProblemNotAllowPretestError, ProblemNotFoundError, RecordNotFoundError, SolutionNotFoundError, ValidationError, @@ -497,7 +497,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler { const file = this.request.files?.file; if (!file || file.size === 0) throw new ValidationError('code'); const sizeLimit = config.type === 'submit_answer' ? 128 * 1024 * 1024 : lengthLimit; - if (file.size > sizeLimit) throw new ValidationError('file'); + if (file.size > sizeLimit) throw new FileTooLargeError('file'); const shouldReadFile = () => { if (config.type === 'objective') return true; if (lang === '_') return false;