core: add penaltyRules validity check

This commit is contained in:
undefined committed 2025-09-08 21:26:21 +08:00
1 parent 3dd1fad0d1
commit 478d161818
1 file changed
+2 -2
+2 -2
View File
@@ -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;
}