Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion src/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down