mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-26 09:09:05 +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
|
? 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:
|
||||||
|
|||||||
Reference in New Issue
Block a user