mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-23 07:41:50 +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
|
||||
: "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