refactor: normalize ASN validation value once

This commit is contained in:
copilot-swe-agent[bot]
2026-06-16 23:46:44 +00:00
committed by GitHub
parent 5e26ceaf02
commit f3a52e31d1

View File

@@ -100,9 +100,10 @@ export function getResourceRuleValueValidationError(
? null
: "Invalid country code provided";
case "ASN":
return /^AS\d+$/i.test(value.trim()) ||
value.trim().toUpperCase() === "ALL" ||
value.trim().toUpperCase() === "AS0"
const normalizedValue = value.trim().toUpperCase();
return /^AS\d+$/i.test(normalizedValue) ||
normalizedValue === "ALL" ||
normalizedValue === "AS0"
? null
: "Invalid ASN provided";
default: