File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -937,14 +937,16 @@ fn path_to_file_url_path(path: &Path) -> Result<Vec<String>, ()> {
937
937
938
938
#[ cfg( windows) ]
939
939
fn path_to_file_url_path ( path : & Path ) -> Result < Vec < String > , ( ) > {
940
+ use std:: path:: { Prefix , Component } ;
940
941
if !path. is_absolute ( ) {
941
942
return Err ( ( ) )
942
943
}
943
944
let mut components = path. components ( ) ;
944
945
let disk = match components. next ( ) {
945
- Some ( new_path:: Component :: Prefix {
946
- parsed : new_path:: Prefix :: Disk ( byte) , ..
947
- } ) => byte,
946
+ Some ( Component :: Prefix ( ref p) ) => match p. kind ( ) {
947
+ Prefix :: Disk ( byte) => byte,
948
+ _ => return Err ( ( ) ) ,
949
+ } ,
948
950
949
951
// FIXME: do something with UNC and other prefixes?
950
952
_ => return Err ( ( ) )
@@ -954,7 +956,7 @@ fn path_to_file_url_path(path: &Path) -> Result<Vec<String>, ()> {
954
956
let mut path = vec ! [ format!( "{}:" , disk as char ) ] ;
955
957
956
958
for component in components {
957
- if component == new_path :: Component :: RootDir { continue }
959
+ if component == Component :: RootDir { continue }
958
960
// FIXME: somehow work with non-unicode?
959
961
let part = match component. as_os_str ( ) . to_str ( ) {
960
962
Some ( s) => s,
You can’t perform that action at this time.
0 commit comments