mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-17 21:01:53 +00:00
refactor: normalize ASN validation value once
This commit is contained in:
committed by
GitHub
parent
5e26ceaf02
commit
f3a52e31d1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user