api types: BackupNamespace: fix depth check on pushing subdir to ns
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
1f2126fd7c
commit
6bfc94ea19
@ -629,12 +629,10 @@ impl BackupNamespace {
|
||||
/// Assumes `subdir` already does not contain any slashes.
|
||||
/// Performs remaining checks and updates the length.
|
||||
fn push_do(&mut self, subdir: String) -> Result<(), Error> {
|
||||
if self.depth() > MAX_NAMESPACE_DEPTH {
|
||||
bail!(
|
||||
"namespace to deep, {} > max {}",
|
||||
self.inner.len(),
|
||||
MAX_NAMESPACE_DEPTH
|
||||
);
|
||||
let depth = self.depth();
|
||||
// check for greater equal to account for the to be added subdir
|
||||
if depth >= MAX_NAMESPACE_DEPTH {
|
||||
bail!("namespace to deep, {depth} >= max {MAX_NAMESPACE_DEPTH}");
|
||||
}
|
||||
|
||||
if self.len + subdir.len() + 1 > MAX_BACKUP_NAMESPACE_LENGTH {
|
||||
|
Loading…
Reference in New Issue
Block a user