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 Owen
parent 3f37408dae
commit de48a0529e

View File

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