File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ use raphtory::{
1717} ;
1818use std:: {
1919 collections:: HashMap ,
20+ ffi:: OsStr ,
2021 io:: { Read , Seek } ,
2122 path:: { Path , PathBuf } ,
2223 sync:: Arc ,
2324} ;
24- use std:: ffi:: OsStr ;
2525use tokio:: fs;
2626use tracing:: warn;
2727use walkdir:: WalkDir ;
@@ -283,12 +283,16 @@ impl Data {
283283 /// Serializes a graph to disk, overwriting any existing data in its folder.
284284 fn encode_graph_to_disk ( graph : GraphWithVectors ) -> Result < ( ) , GraphError > {
285285 let folder_path = graph. folder . get_base_path ( ) ;
286- let bak_name = "_" . to_string ( ) + folder_path. file_name ( ) . and_then ( |n| n. to_str ( ) ) . unwrap_or ( "" ) ;
286+ let bak_name = "_" . to_string ( )
287+ + folder_path
288+ . file_name ( )
289+ . and_then ( |n| n. to_str ( ) )
290+ . unwrap_or ( "" ) ;
287291 let bak_path = folder_path. with_file_name ( bak_name) ;
288292
289293 // Write to backup path first
290294 graph. graph . encode ( & bak_path) ?;
291-
295+
292296 if folder_path. exists ( ) {
293297 // delete old data
294298 std:: fs:: remove_dir_all ( folder_path) ?;
Original file line number Diff line number Diff line change @@ -128,8 +128,12 @@ pub(crate) fn valid_path(
128128 if full_path. join ( META_PATH ) . exists ( ) {
129129 if namespace {
130130 return Err ( InvalidPathReason :: ParentIsGraph ( user_facing_path) ) ;
131- } else if component. to_str ( ) . ok_or ( InvalidPathReason :: NonUTFCharacters ) ?. starts_with ( "_" ) {
132- return Err ( InvalidPathReason :: GraphNamePrefix )
131+ } else if component
132+ . to_str ( )
133+ . ok_or ( InvalidPathReason :: NonUTFCharacters ) ?
134+ . starts_with ( "_" )
135+ {
136+ return Err ( InvalidPathReason :: GraphNamePrefix ) ;
133137 }
134138 }
135139 //check for symlinks
You can’t perform that action at this time.
0 commit comments