fixed validation checking custom background twice

This commit is contained in:
Miodec 2021-08-04 14:38:00 +01:00
parent 99fca1b3e3
commit 9a25f22a0b

View file

@ -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;