mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-22 23:31:49 +00:00
refactor: normalize ASN validation value once
This commit is contained in:
committed by
Owen
parent
3f37408dae
commit
de48a0529e
@@ -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