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

View File

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