Merge pull request #3329 from Ms2ger/2877-base64

Call from_base64 on a vector slice rather than a string slice (fixes #2877).
This commit is contained in:
Josh Matthews 2014-09-14 09:50:34 -04:00
commit 23ec53042c

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())));
}