@@ -1232,10 +1232,8 @@ fn write_minify_replacer<W: Write>(dst: &mut W,
1232
1232
/// static HTML tree. Each component in the cleaned path will be passed as an
1233
1233
/// argument to `f`. The very last component of the path (ie the file name) will
1234
1234
/// 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
1237
1235
fn clean_srcpath < F > ( src_root : & Path , p : & Path , keep_filename : bool , mut f : F ) where
1238
- F : FnMut ( & str ) ,
1236
+ F : FnMut ( & OsStr ) ,
1239
1237
{
1240
1238
// make it relative, if possible
1241
1239
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
1248
1246
}
1249
1247
1250
1248
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) ,
1253
1251
_ => continue ,
1254
1252
}
1255
1253
}
@@ -1348,7 +1346,7 @@ impl<'a> SourceCollector<'a> {
1348
1346
cur. push ( component) ;
1349
1347
fs:: create_dir_all ( & cur) . unwrap ( ) ;
1350
1348
root_path. push_str ( "../" ) ;
1351
- href. push_str ( component) ;
1349
+ href. push_str ( & component. to_string_lossy ( ) ) ;
1352
1350
href. push ( '/' ) ;
1353
1351
} ) ;
1354
1352
let mut fname = p. file_name ( )
@@ -2227,7 +2225,7 @@ impl<'a> Item<'a> {
2227
2225
} ;
2228
2226
2229
2227
clean_srcpath ( & src_root, file, false , |component| {
2230
- path. push_str ( component) ;
2228
+ path. push_str ( & component. to_string_lossy ( ) ) ;
2231
2229
path. push ( '/' ) ;
2232
2230
} ) ;
2233
2231
let mut fname = file. file_name ( ) . expect ( "source has no filename" )
0 commit comments