@@ -1232,10 +1232,8 @@ fn write_minify_replacer<W: Write>(dst: &mut W,
12321232/// static HTML tree. Each component in the cleaned path will be passed as an
12331233/// argument to `f`. The very last component of the path (ie the file name) will
12341234/// be passed to `f` if `keep_filename` is true, and ignored otherwise.
1235- // FIXME (#9639): The closure should deal with &[u8] instead of &str
1236- // FIXME (#9639): This is too conservative, rejecting non-UTF-8 paths
12371235fn clean_srcpath < F > ( src_root : & Path , p : & Path , keep_filename : bool , mut f : F ) where
1238- F : FnMut ( & str ) ,
1236+ F : FnMut ( & OsStr ) ,
12391237{
12401238 // make it relative, if possible
12411239 let p = p. strip_prefix ( src_root) . unwrap_or ( p) ;
@@ -1248,8 +1246,8 @@ fn clean_srcpath<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F) wh
12481246 }
12491247
12501248 match c {
1251- Component :: ParentDir => f ( "up" ) ,
1252- Component :: Normal ( c) => f ( c. to_str ( ) . unwrap ( ) ) ,
1249+ Component :: ParentDir => f ( "up" . as_ref ( ) ) ,
1250+ Component :: Normal ( c) => f ( c) ,
12531251 _ => continue ,
12541252 }
12551253 }
@@ -1348,7 +1346,7 @@ impl<'a> SourceCollector<'a> {
13481346 cur. push ( component) ;
13491347 fs:: create_dir_all ( & cur) . unwrap ( ) ;
13501348 root_path. push_str ( "../" ) ;
1351- href. push_str ( component) ;
1349+ href. push_str ( & component. to_string_lossy ( ) ) ;
13521350 href. push ( '/' ) ;
13531351 } ) ;
13541352 let mut fname = p. file_name ( )
@@ -2227,7 +2225,7 @@ impl<'a> Item<'a> {
22272225 } ;
22282226
22292227 clean_srcpath ( & src_root, file, false , |component| {
2230- path. push_str ( component) ;
2228+ path. push_str ( & component. to_string_lossy ( ) ) ;
22312229 path. push ( '/' ) ;
22322230 } ) ;
22332231 let mut fname = file. file_name ( ) . expect ( "source has no filename" )
0 commit comments