[pve-devel] [PATCH proxmox] fix #7077: Improve error message for SDN IDs shorter than 2 characters
Arthur Bied-Charreton
a.bied-charreton at proxmox.com
Wed Jan 21 11:32:31 CET 2026
The regex in verify_sdn_id implicitly requires at least 2 characters, but
shorter IDs only failed with "contains illegal characters". Now return a
clearer error message for this case.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton at proxmox.com>
---
pve-api-types/src/types/verifiers.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index c45063b5..aa6c7f40 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -269,6 +269,10 @@ pub fn verify_sdn_id(s: &str) -> Result<(), Error> {
bail!("SDN ID cannot be longer than 8 characters")
}
+ if s.len() < 2 {
+ bail!("SDN ID cannot be shorter than 2 characters");
+ }
+
if !SDN_ID.is_match(s) {
bail!("SDN ID contains illegal characters");
}
--
2.47.3
More information about the pve-devel
mailing list