diff --git a/Cargo.toml b/Cargo.toml index 39d2c600..12c6f30b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ hyperx = "1.3.0" snafu = { version = "0.7", features = ["backtraces"] } once_cell = "1.7.2" arc-swap = "1.3.0" -base64 = "0.20.0" +base64 = "0.21.0" bytes = "1.0.1" jsonwebtoken = "8" futures-core = { version = "0.3.15", optional = true } diff --git a/src/api/repos.rs b/src/api/repos.rs index 3cf5eb6c..ca008a10 100644 --- a/src/api/repos.rs +++ b/src/api/repos.rs @@ -240,11 +240,12 @@ impl<'octo> RepoHandler<'octo> { message: impl Into, content: impl AsRef<[u8]>, ) -> UpdateFileBuilder<'_, '_> { + use base64::Engine; UpdateFileBuilder::new( self, path.into(), message.into(), - base64::encode(content), + base64::prelude::BASE64_STANDARD.encode(content), None, ) } @@ -284,11 +285,12 @@ impl<'octo> RepoHandler<'octo> { content: impl AsRef<[u8]>, sha: impl Into, ) -> UpdateFileBuilder<'_, '_> { + use base64::Engine; UpdateFileBuilder::new( self, path.into(), message.into(), - base64::encode(content), + base64::prelude::BASE64_STANDARD.encode(content), Some(sha.into()), ) } diff --git a/src/models/events/payload/pull_request_review.rs b/src/models/events/payload/pull_request_review.rs index ff603679..30ca5e43 100644 --- a/src/models/events/payload/pull_request_review.rs +++ b/src/models/events/payload/pull_request_review.rs @@ -1,7 +1,4 @@ -use crate::models::{ - pulls::{PullRequest, Review}, - Repository, User, -}; +use crate::models::pulls::{PullRequest, Review}; use serde::{Deserialize, Serialize}; /// The payload in a [`super::EventPayload::PullRequestReviewEvent`] type. diff --git a/src/models/repos.rs b/src/models/repos.rs index 2183590a..e4ddbe34 100644 --- a/src/models/repos.rs +++ b/src/models/repos.rs @@ -207,10 +207,11 @@ impl Content { /// # } /// ``` pub fn decoded_content(&self) -> Option { + use base64::Engine; self.content.as_ref().and_then(|c| { let mut content = c.as_bytes().to_owned(); content.retain(|b| !b" \n\t\r\x0b\x0c".contains(b)); - let c = base64::decode(&content).unwrap(); + let c = base64::prelude::BASE64_STANDARD.decode(content).unwrap(); Some(String::from_utf8_lossy(&c).into_owned()) }) }