mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: add penaltyRules validity check
This commit is contained in:
1 file changed
+2
-2
@@ -22,8 +22,8 @@ import { ContestCodeHandler, ContestFileDownloadHandler, ContestScoreboardHandle
|
||||
|
||||
const validatePenaltyRules = (input: string) => {
|
||||
try {
|
||||
yaml.load(input);
|
||||
return true;
|
||||
const res = yaml.load(input);
|
||||
return typeof res === 'object' && res !== null && Object.keys(res).every((key) => typeof res[key] === 'number');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user