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.
|
/// Assumes `subdir` already does not contain any slashes.
|
||||||
/// Performs remaining checks and updates the length.
|
/// Performs remaining checks and updates the length.
|
||||||
fn push_do(&mut self, subdir: String) -> Result<(), Error> {
|
fn push_do(&mut self, subdir: String) -> Result<(), Error> {
|
||||||
if self.depth() > MAX_NAMESPACE_DEPTH {
|
let depth = self.depth();
|
||||||
bail!(
|
// check for greater equal to account for the to be added subdir
|
||||||
"namespace to deep, {} > max {}",
|
if depth >= MAX_NAMESPACE_DEPTH {
|
||||||
self.inner.len(),
|
bail!("namespace to deep, {depth} >= max {MAX_NAMESPACE_DEPTH}");
|
||||||
MAX_NAMESPACE_DEPTH
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.len + subdir.len() + 1 > MAX_BACKUP_NAMESPACE_LENGTH {
|
if self.len + subdir.len() + 1 > MAX_BACKUP_NAMESPACE_LENGTH {
|
||||||
|
|
Loading…
Reference in New Issue