File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
rust/cubestore/cubestore/src/remotefs Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,19 @@ impl LocalDirRemoteFs {
326326 pub async fn remove_empty_paths ( root : PathBuf , path : PathBuf ) -> Result < ( ) , CubeError > {
327327 if let Some ( parent_path) = path. parent ( ) {
328328 let mut dir = fs:: read_dir ( parent_path) . await ?;
329- if !parent_path. starts_with ( "temp-uploads" ) && dir. next_entry ( ) . await ?. is_none ( ) {
330- fs:: remove_dir ( parent_path) . await ?;
329+ if !parent_path
330+ . as_os_str ( )
331+ . to_string_lossy ( )
332+ . contains ( "temp-uploads" )
333+ && dir. next_entry ( ) . await ?. is_none ( )
334+ {
335+ fs:: remove_dir ( parent_path) . await . map_err ( |e| {
336+ CubeError :: internal ( format ! (
337+ "Error during removal of empty path '{}': {}" ,
338+ parent_path. as_os_str( ) . to_string_lossy( ) ,
339+ e
340+ ) )
341+ } ) ?;
331342 }
332343 if root != parent_path. to_path_buf ( ) {
333344 return Ok ( Self :: remove_empty_paths_boxed ( root, parent_path. to_path_buf ( ) ) . await ?) ;
You can’t perform that action at this time.
0 commit comments