diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 2280050b6..639b06721 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "3.14.18", + "version": "3.14.19", "bin": "bin/hydrooj.js", "main": "src/loader", "module": "src/loader", diff --git a/packages/hydrooj/src/handler/misc.ts b/packages/hydrooj/src/handler/misc.ts index 879de6b3f..3caed93a8 100644 --- a/packages/hydrooj/src/handler/misc.ts +++ b/packages/hydrooj/src/handler/misc.ts @@ -50,14 +50,14 @@ export class FilesHandler extends Handler { async postUploadFile(domainId: string, filename: string) { this.checkPriv(PRIV.PRIV_CREATE_FILE); if ((this.user._files?.length || 0) >= system.get('limit.user_files')) { - throw new ForbiddenError('File limit exceeded.'); + if (!this.user.hasPriv(PRIV.PRIV_UNLIMITED_QUOTA)) throw new ForbiddenError('File limit exceeded.'); } const file = this.request.files?.file; if (!file) throw new ValidationError('file'); const f = statSync(file.filepath); const size = Math.sum((this.user._files || []).map((i) => i.size)) + f.size; if (size >= system.get('limit.user_files_size')) { - throw new ForbiddenError('File size limit exceeded.'); + if (!this.user.hasPriv(PRIV.PRIV_UNLIMITED_QUOTA)) throw new ForbiddenError('File size limit exceeded.'); } if (!filename) filename = file.originalFilename || String.random(16); if (filename.includes('/') || filename.includes('..')) throw new ValidationError('filename', null, 'Bad filename');