Skip to content

Commit

Permalink
chore: remove max_children limit for root folder
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Oct 21, 2024
1 parent b6f4404 commit c9da728
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ic_oss_bucket/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ impl FoldersTree {
Err("parent folder is not writable".to_string())?;
}

if parent.folders.len() + parent.files.len() >= max_children {
// no limit for root folder
if metadata.parent > 0 && parent.folders.len() + parent.files.len() >= max_children {
Err("children exceeds limit".to_string())?;
}
parent.folders.insert(id);
Expand Down Expand Up @@ -601,7 +602,8 @@ impl FoldersTree {
Err("parent folder is not writable".to_string())?;
}

if folder.folders.len() + folder.files.len() >= max_children {
// no limit for root folder
if parent > 0 && folder.folders.len() + folder.files.len() >= max_children {
Err("children exceeds limit".to_string())?;
}

Expand Down Expand Up @@ -649,7 +651,7 @@ impl FoldersTree {
Err(format!("folder {} is not writable", to))?;
}

if to_folder.folders.len() + to_folder.files.len() >= max_children {
if to > 0 && to_folder.folders.len() + to_folder.files.len() >= max_children {
Err("children exceeds limit".to_string())?;
}

Expand Down Expand Up @@ -699,7 +701,7 @@ impl FoldersTree {
Err(format!("folder {} is not writable", to))?;
}

if to_folder.folders.len() + to_folder.files.len() >= max_children {
if to > 0 && to_folder.folders.len() + to_folder.files.len() >= max_children {
Err("children exceeds limit".to_string())?;
}

Expand Down

0 comments on commit c9da728

Please sign in to comment.