diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-25 14:02:56 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-25 14:02:56 +0100 |
commit | b9371c68563fc39e6b42cce54c7ebb04d4a3a60b (patch) | |
tree | ba86e3828b226ee248633948b59e0b2ff6d9150d /components/script | |
parent | b1669b853b3462d32295431321dcb69377060df4 (diff) | |
download | servo-b9371c68563fc39e6b42cce54c7ebb04d4a3a60b.tar.gz servo-b9371c68563fc39e6b42cce54c7ebb04d4a3a60b.zip |
Update base64 to 0.10.1
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/window.rs | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index cae434ab7d4..4ece839fdc6 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -32,7 +32,7 @@ tinyfiledialogs = "3.0" [dependencies] app_units = "0.7" backtrace = {version = "0.3", optional = true} -base64 = "0.9" +base64 = "0.10.1" bitflags = "1.0" bluetooth_traits = {path = "../bluetooth_traits"} byteorder = "1.0" diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index dce37b4f0bc..104060c25ba 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -509,12 +509,9 @@ pub fn base64_atob(input: DOMString) -> Fallible<DOMString> { return Err(Error::InvalidCharacter); } - match base64::decode(&input) { - Ok(data) => Ok(DOMString::from( - data.iter().map(|&b| b as char).collect::<String>(), - )), - Err(..) => Err(Error::InvalidCharacter), - } + let data = base64::decode_config(&input, base64::STANDARD.decode_allow_trailing_bits(true)) + .map_err(|_| Error::InvalidCharacter)?; + Ok(data.iter().map(|&b| b as char).collect::<String>().into()) } impl WindowMethods for Window { |