@@ -935,18 +935,28 @@ pub trait SeleniumManager {
935
935
}
936
936
937
937
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
+ ) ;
939
944
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 , "" )
943
946
}
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
944
955
}
945
956
946
957
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) ;
950
960
951
961
if path. exists ( ) {
952
962
escaped_path = self . canonicalize_path ( path. to_path_buf ( ) ) ;
@@ -957,14 +967,16 @@ pub trait SeleniumManager {
957
967
Command :: new_single ( format_one_arg ( ESCAPE_COMMAND , escaped_path. as_str ( ) ) ) ;
958
968
escaped_path = run_shell_command ( "bash" , "-c" , escape_command) . unwrap_or_default ( ) ;
959
969
if escaped_path. is_empty ( ) {
960
- escaped_path = original_path . clone ( ) ;
970
+ escaped_path = string_path . clone ( ) ;
961
971
}
962
972
}
963
973
}
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
+ }
968
980
escaped_path
969
981
}
970
982
0 commit comments