[pbs-devel] [RFC PATCH] fix #3039: use the same ID regex for info and api

Dominik Csapak d.csapak at proxmox.com
Mon Nov 2 13:08:04 CET 2020


in the api we use PROXMOX_SAFE_ID_REGEX for backup ids, but here
(where we use it to list them) we use a local regex

since the first is a superset of the one used here, simply extend
the local one

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
i mean we *could* refactor that regex to a place where we could
use it from both places (tools? proxmox crate?), but is it worth it for
the 3 character changes?

 src/backup/backup_info.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backup/backup_info.rs b/src/backup/backup_info.rs
index 3ace44dc..c5d245e9 100644
--- a/src/backup/backup_info.rs
+++ b/src/backup/backup_info.rs
@@ -9,7 +9,7 @@ use lazy_static::lazy_static;
 
 use super::manifest::MANIFEST_BLOB_NAME;
 
-macro_rules! BACKUP_ID_RE { () => (r"[A-Za-z0-9][A-Za-z0-9_-]+") }
+macro_rules! BACKUP_ID_RE { () => (r"[A-Za-z0-9_][A-Za-z0-9._\-]*") }
 macro_rules! BACKUP_TYPE_RE { () => (r"(?:host|vm|ct)") }
 macro_rules! BACKUP_TIME_RE { () => (r"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z") }
 
-- 
2.20.1






More information about the pbs-devel mailing list