@@ -935,18 +935,28 @@ pub trait SeleniumManager {
935935 }
936936
937937 fn canonicalize_path ( & self , path_buf : PathBuf ) -> String {
938- let canon_path = path_buf_to_string ( path_buf. as_path ( ) . canonicalize ( ) . unwrap_or ( path_buf) ) ;
938+ let mut canon_path = path_buf_to_string (
939+ path_buf
940+ . as_path ( )
941+ . canonicalize ( )
942+ . unwrap_or ( path_buf. clone ( ) ) ,
943+ ) ;
939944 if WINDOWS . is ( self . get_os ( ) ) {
940- canon_path. replace ( UNC_PREFIX , "" )
941- } else {
942- canon_path
945+ canon_path = canon_path. replace ( UNC_PREFIX , "" )
943946 }
947+ if !path_buf_to_string ( path_buf. clone ( ) ) . eq ( & canon_path) {
948+ self . get_logger ( ) . trace ( format ! (
949+ "Path {} has been canonicalized to {}" ,
950+ path_buf. display( ) ,
951+ canon_path
952+ ) ) ;
953+ }
954+ canon_path
944955 }
945956
946957 fn get_escaped_path ( & self , string_path : String ) -> String {
947- let original_path = string_path. clone ( ) ;
948- let mut escaped_path = string_path;
949- let path = Path :: new ( & original_path) ;
958+ let mut escaped_path = string_path. clone ( ) ;
959+ let path = Path :: new ( & string_path) ;
950960
951961 if path. exists ( ) {
952962 escaped_path = self . canonicalize_path ( path. to_path_buf ( ) ) ;
@@ -957,14 +967,16 @@ pub trait SeleniumManager {
957967 Command :: new_single ( format_one_arg ( ESCAPE_COMMAND , escaped_path. as_str ( ) ) ) ;
958968 escaped_path = run_shell_command ( "bash" , "-c" , escape_command) . unwrap_or_default ( ) ;
959969 if escaped_path. is_empty ( ) {
960- escaped_path = original_path . clone ( ) ;
970+ escaped_path = string_path . clone ( ) ;
961971 }
962972 }
963973 }
964- self . get_logger ( ) . trace ( format ! (
965- "Original path: {} - Escaped path: {}" ,
966- original_path, escaped_path
967- ) ) ;
974+ if !string_path. eq ( & escaped_path) {
975+ self . get_logger ( ) . trace ( format ! (
976+ "Path {} has been escaped to {}" ,
977+ string_path, escaped_path
978+ ) ) ;
979+ }
968980 escaped_path
969981 }
970982
0 commit comments