servo: Merge #3280 - Fix loading of file URLs with spaces (from metajack:path-with-spaces)

Source-Repo: https://github.com/servo/servo
Source-Revision: 3bd5ef3384610f6d666dedc9a5099f0c9d6d2cfc
This commit is contained in:
Jack Moffitt 2014-09-11 13:50:03 +10:00
parent b37690d9bb
commit 4c9e69c5d4

View File

@ -35,7 +35,8 @@ pub fn factory() -> LoaderTask {
assert!("file" == url.scheme.as_slice());
let progress_chan = start_sending(start_chan, Metadata::default(url.clone()));
spawn_named("file_loader", proc() {
match File::open_mode(&Path::new(url.serialize_path().unwrap()), io::Open, io::Read) {
let file_path: Path = url.to_file_path().unwrap();
match File::open_mode(&Path::new(file_path), io::Open, io::Read) {
Ok(ref mut reader) => {
let res = read_all(reader as &mut io::Stream, &progress_chan);
progress_chan.send(Done(res));