Call from_base64 on a vector slice rather than a string slice (fixes #2877).

This commit is contained in:
Ms2ger 2014-09-14 10:32:59 +02:00
parent 97e068b1c2
commit dbefb2f0fd

View file

@ -66,10 +66,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
// FIXME(#2909): Its unclear what to do with non-alphabet characters,
// but Acid 3 apparently depends on spaces being ignored.
let bytes = bytes.move_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
// FIXME(#2877): use bytes.as_slice().from_base64() when we upgrade to a Rust version
// that includes https://github.com/rust-lang/rust/pull/15810
let fake_utf8 = unsafe { str::raw::from_utf8(bytes.as_slice()) };
match fake_utf8.from_base64() {
match bytes.as_slice().from_base64() {
Err(..) => {
progress_chan.send(Done(Err("non-base64 data uri".to_string())));
}