api-types: add missing slash in optional ns path regex

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-04-25 11:33:12 +02:00 committed by Thomas Lamprecht
parent 89ae3c3255
commit 2772159692
2 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,7 @@ const_regex! {
pub BACKUP_DATE_REGEX = concat!(r"^", BACKUP_TIME_RE!() ,r"$");
pub GROUP_PATH_REGEX = concat!(
r"^(", BACKUP_NS_PATH_RE!(), r")?",
r"^(", BACKUP_NS_PATH_RE!(), r"/)?",
r"(", BACKUP_TYPE_RE!(), ")/",
r"(", BACKUP_ID_RE!(), r")$",
);

View File

@ -47,16 +47,20 @@ macro_rules! BACKUP_NS_PATH_RE {
macro_rules! SNAPSHOT_PATH_REGEX_STR {
() => (
concat!(
r"(", BACKUP_NS_PATH_RE!(), ")?",
r"(?:(", BACKUP_NS_PATH_RE!(), ")/)?",
r"(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), ")/(", BACKUP_TIME_RE!(), r")",
)
);
}
#[rustfmt::skip]
#[macro_export]
macro_rules! GROUP_OR_SNAPSHOT_PATH_REGEX_STR {
() => {
concat!(SNAPSHOT_PATH_REGEX_STR!(), "?")
concat!(
r"(?:(", BACKUP_NS_PATH_RE!(), ")/)?",
r"(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), ")(?:/(", BACKUP_TIME_RE!(), r"))?",
)
};
}