diff --git a/Cargo.toml b/Cargo.toml index ff87f662..4e1cd461 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,13 +20,13 @@ pretty_env_logger = "0.4" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } [dependencies] -base64 = "0.13" +base64 = "0.21" data-encoding = "2" dirs = { version = "3.0", optional = true } futures = { version = "0.3", default-features = false } http = "0.2" hyperx = "1" -jsonwebtoken = { version = "7", optional = true } +jsonwebtoken = { version = "8", optional = true } log = "0.4" mime = "0.3" percent-encoding = "2" diff --git a/src/content.rs b/src/content.rs index 74dcba9b..1276194d 100644 --- a/src/content.rs +++ b/src/content.rs @@ -248,15 +248,19 @@ impl<'de> Deserialize<'de> for DecodedContents { where E: de::Error, { + use base64::engine::{Engine, general_purpose::STANDARD}; // GitHub wraps the base64 to column 60. The base64 crate // doesn't handle whitespace, nor does it take a reader, so we // must unfortunately allocate again and remove all new lines. let v = v.replace("\n", ""); - let decoded = base64::decode_config(&v, base64::STANDARD).map_err(|e| match e { + let decoded = STANDARD.decode(&v).map_err(|e| match e { base64::DecodeError::InvalidLength => { E::invalid_length(v.len(), &"invalid base64 length") } + base64::DecodeError::InvalidPadding => { + E::invalid_length(v.len(), &"invalid base64 padding") + } base64::DecodeError::InvalidByte(offset, byte) => E::invalid_value( de::Unexpected::Bytes(&[byte]), &format!("valid base64 character at offset {}", offset).as_str(),