mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-10 17:04:49 +08:00
fixed validation checking custom background twice
This commit is contained in:
parent
99fca1b3e3
commit
9a25f22a0b
1 changed files with 21 additions and 19 deletions
|
@ -83,30 +83,32 @@ function validateConfig(config) {
|
|||
// if (key === "resultFilters") return;
|
||||
// if (key === "customBackground") return;
|
||||
if (key === "customBackground" || key === "customLayoutfluid") {
|
||||
if (/[<>]/.test(config[key])) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
`Invalid config: ${key}:${config.key} failed regex check`
|
||||
);
|
||||
}
|
||||
}
|
||||
let val = config[key];
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach((valarr) => {
|
||||
if (!isConfigKeyValid(valarr)) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
`Invalid config: ${key}:${valarr} failed regex check`
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!isConfigKeyValid(val)) {
|
||||
let val = config[key];
|
||||
if (/[<>]/.test(val)) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
`Invalid config: ${key}:${val} failed regex check`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let val = config[key];
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach((valarr) => {
|
||||
if (!isConfigKeyValid(valarr)) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
`Invalid config: ${key}:${valarr} failed regex check`
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!isConfigKeyValid(val)) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
`Invalid config: ${key}:${val} failed regex check`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue