core: type check before adding langs data

This commit is contained in:
undefined committed 2022-01-26 22:51:45 +08:00
1 parent 8d5ec0ab03
commit 17cab51f5f
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.3.17",
"version": "3.3.18",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+3 -3
View File
@@ -306,9 +306,9 @@ export class ProblemDetailHandler extends ProblemHandler {
if (!ddoc || !pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid);
this.pdoc.config = pdoc.config;
}
if (ddoc.langs) {
(this.pdoc.config as ProblemConfig).langs = intersection(
(this.pdoc.config as ProblemConfig).langs || ddoc.langs.split(','),
if (ddoc.langs && typeof this.pdoc.config !== 'string') {
this.pdoc.config.langs = intersection(
this.pdoc.config.langs || ddoc.langs.split(','),
ddoc.langs.split(','),
);
}