@@ -201,20 +201,23 @@ pub struct PathToUrlError(pub PathBuf);
201201
202202#[ allow( clippy:: result_unit_err) ]
203203pub fn url_from_file_path ( path : & Path ) -> Result < Url , PathToUrlError > {
204+ let path = normalize_path ( Cow :: Borrowed ( path) ) ;
204205 #[ cfg( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ]
205- return Url :: from_file_path ( path)
206+ return Url :: from_file_path ( & path)
206207 . map_err ( |( ) | PathToUrlError ( path. to_path_buf ( ) ) ) ;
207208 #[ cfg( not( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
208- url_from_file_path_wasm ( path) . map_err ( |( ) | PathToUrlError ( path. to_path_buf ( ) ) )
209+ url_from_file_path_wasm ( & path)
210+ . map_err ( |( ) | PathToUrlError ( path. to_path_buf ( ) ) )
209211}
210212
211213#[ allow( clippy:: result_unit_err) ]
212214pub fn url_from_directory_path ( path : & Path ) -> Result < Url , PathToUrlError > {
215+ let path = normalize_path ( Cow :: Borrowed ( path) ) ;
213216 #[ cfg( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ]
214- return Url :: from_directory_path ( path)
217+ return Url :: from_directory_path ( & path)
215218 . map_err ( |( ) | PathToUrlError ( path. to_path_buf ( ) ) ) ;
216219 #[ cfg( not( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
217- url_from_directory_path_wasm ( path)
220+ url_from_directory_path_wasm ( & path)
218221 . map_err ( |( ) | PathToUrlError ( path. to_path_buf ( ) ) )
219222}
220223
0 commit comments