mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
ui: fix lang select
This commit is contained in:
1 parent
ce8b77a6f7
commit
865f30fe42
9 files changed
+32
-34
No files matched your search
@@ -12,11 +12,11 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.198.0",
|
||||
"@aws-sdk/lib-storage": "^3.198.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.198.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.198.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.198.0",
|
||||
"@aws-sdk/client-s3": "^3.202.0",
|
||||
"@aws-sdk/lib-storage": "^3.202.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.201.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.202.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.202.0",
|
||||
"@graphql-tools/schema": "^8.5.1",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"adm-zip": "0.5.5",
|
||||
@@ -51,7 +51,7 @@
|
||||
"schemastery": "^3.5.4",
|
||||
"semver": "^7.3.8",
|
||||
"serialize-javascript": "^6.0.0",
|
||||
"superagent": "^8.0.2",
|
||||
"superagent": "^8.0.3",
|
||||
"thirty-two": "^1.0.2",
|
||||
"ws": "^8.10.0"
|
||||
},
|
||||
@@ -63,7 +63,7 @@
|
||||
"@types/koa-compress": "^4.0.3",
|
||||
"@types/koa-router": "^7.4.4",
|
||||
"@types/koa-static-cache": "^5.1.1",
|
||||
"@types/lodash": "^4.14.186",
|
||||
"@types/lodash": "^4.14.187",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"@types/mongodb": "^3.6.20",
|
||||
"@types/nodemailer": "^6.4.6",
|
||||
|
||||
@@ -511,7 +511,11 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
@param('input', Types.String, true)
|
||||
@param('tid', Types.ObjectID, true)
|
||||
async post(domainId: string, lang: string, code: string, pretest = false, input = '', tid?: ObjectID) {
|
||||
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
|
||||
const config = this.pdoc.config;
|
||||
if (typeof config === 'string' || config === null) throw new BadRequestError('Problem configuration incorrect');
|
||||
if (config.type === 'objective') {
|
||||
lang = '_';
|
||||
} else if (config.langs && !config.langs.includes(lang)) {
|
||||
throw new BadRequestError('Language not allowed.');
|
||||
}
|
||||
if (pretest) {
|
||||
@@ -527,8 +531,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
if (!code) {
|
||||
const file = this.request.files?.file;
|
||||
if (!file || file.size === 0) throw new ValidationError('code');
|
||||
const config = this.response.body.pdoc.config;
|
||||
if (typeof config !== 'object' || config === null) throw new BadRequestError('Incorrect problem config');
|
||||
const sizeLimit = config.type === 'submit_answer' ? 128 * 1024 * 1024 : 65535;
|
||||
if (file.size > sizeLimit) throw new ValidationError('file');
|
||||
if (file.size > 65535 || await isBinaryFile(file.filepath, file.size)) {
|
||||
|
||||
Reference in new issue
Block a user