BackupNamespace: fix deserialize of root NS

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-04-29 13:25:13 +02:00 committed by Thomas Lamprecht
parent be5b3ebfdd
commit 6dd8a2ced0
1 changed files with 5 additions and 0 deletions

View File

@ -484,6 +484,11 @@ impl BackupNamespace {
/// Try to parse a string into a namespace. /// Try to parse a string into a namespace.
pub fn new(name: &str) -> Result<Self, Error> { pub fn new(name: &str) -> Result<Self, Error> {
let mut this = Self::root(); let mut this = Self::root();
if name.is_empty() {
return Ok(this);
}
for name in name.split('/') { for name in name.split('/') {
this.push(name.to_string())?; this.push(name.to_string())?;
} }