Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies #493

Merged
merged 2 commits into from
Apr 26, 2024
Merged
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
11 changes: 6 additions & 5 deletions google-apis-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "google-apis-common"
version = "6.0.3"
version = "6.0.4"
authors = ["Sebastian Thiel <[email protected]>"]
repository = "https://github.com/Byron/google-apis-rs"
homepage = "https://github.com/Byron/google-apis-rs/google-apis-common"
Expand All @@ -18,15 +18,16 @@ doctest = false
[dependencies]
mime = "^ 0.3"
serde = { version = "^ 1.0", features = ["derive"] }
serde_with = "2.0.1"
serde_with = "3.0"
serde_json = "^ 1.0"

base64 = "0.13.0"
base64 = "0.22"
chrono = { version = "0.4.35", default-features = false, features = ["clock", "serde"] }
url = "= 1.7"
url = "2.0"
percent-encoding = "2.0"

yup-oauth2 = { version = "9", optional = true }
itertools = "^ 0.10"
itertools = "^ 0.12"
hyper = { version = "^ 0.14", features = ["client", "http2"] }
http = "^0.2"
tokio = { version = "^1.0", features = ["time"] }
Expand Down
11 changes: 7 additions & 4 deletions google-apis-common/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ pub mod duration {
}

pub mod standard_base64 {
use base64::Engine as _;
use serde::{Deserialize, Deserializer, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
use std::borrow::Cow;

pub struct Wrapper;

pub fn to_string(bytes: &Vec<u8>) -> String {
base64::encode_config(bytes, base64::STANDARD)
base64::prelude::BASE64_STANDARD.encode(bytes)
}

impl SerializeAs<Vec<u8>> for Wrapper {
Expand All @@ -169,20 +170,21 @@ pub mod standard_base64 {
D: Deserializer<'de>,
{
let s: Cow<str> = Deserialize::deserialize(deserializer)?;
base64::decode_config(s.as_ref(), base64::STANDARD).map_err(serde::de::Error::custom)
base64::prelude::BASE64_STANDARD.decode(s.as_ref()).map_err(serde::de::Error::custom)
}
}
}

pub mod urlsafe_base64 {
use base64::Engine as _;
use serde::{Deserialize, Deserializer, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
use std::borrow::Cow;

pub struct Wrapper;

pub fn to_string(bytes: &Vec<u8>) -> String {
base64::encode_config(bytes, base64::URL_SAFE)
base64::prelude::BASE64_URL_SAFE.encode(bytes)
}

impl SerializeAs<Vec<u8>> for Wrapper {
Expand All @@ -200,7 +202,7 @@ pub mod urlsafe_base64 {
D: Deserializer<'de>,
{
let s: Cow<str> = Deserialize::deserialize(deserializer)?;
base64::decode_config(s.as_ref(), base64::URL_SAFE).map_err(serde::de::Error::custom)
base64::prelude::BASE64_URL_SAFE.decode(s.as_ref()).map_err(serde::de::Error::custom)
}
}
}
Expand All @@ -212,6 +214,7 @@ pub fn datetime_to_string(datetime: &chrono::DateTime<chrono::offset::Utc>) -> S
#[cfg(test)]
mod test {
use super::{duration, standard_base64, urlsafe_base64};
use base64::Engine as _;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};

Expand Down
3 changes: 2 additions & 1 deletion google-apis-common/src/url.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;

use ::url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
use ::percent_encoding::{percent_encode, AsciiSet, CONTROLS};
use ::url::Url;

pub struct Params<'a> {
Expand Down Expand Up @@ -40,6 +40,7 @@ impl<'a> Params<'a> {
from: &str,
url_encode: bool,
) -> String {
const DEFAULT_ENCODE_SET: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'#').add(b'<').add(b'>').add(b'`').add(b'?').add(b'{').add(b'}');
if url_encode {
let mut replace_with: Cow<str> = self.get(param).unwrap_or_default().into();
if from.as_bytes()[1] == b'+' {
Expand Down
Loading