diff --git a/Cargo.toml b/Cargo.toml index 83552f7..2e7dd0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ url = "1" hyper-old-types = "0.11.0" futures-util = "0.3.25" static_assertions = "1.1.0" +percent-encoding = "2.2.0" [dependencies.uuid] version = "1.2.2" diff --git a/src/registration.rs b/src/registration.rs index 4f4e8af..00e4d65 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -1,8 +1,8 @@ use std::borrow::Cow; use log::{as_debug, as_serde, debug, error, trace}; +use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; use reqwest::Client; -use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; use uuid::Uuid; use crate::{ @@ -10,10 +10,7 @@ use crate::{ helpers::read_response::read_response, log_serde, scopes::Scopes, - Data, - Error, - Mastodon, - Result, + Data, Error, Mastodon, Result, }; const DEFAULT_REDIRECT_URI: &str = "urn:ietf:wg:oauth:2.0:oob"; @@ -309,7 +306,7 @@ impl Registered { /// in a browser. pub fn authorize_url(&self) -> Result { let scopes = format!("{}", self.scopes); - let scopes: String = utf8_percent_encode(&scopes, DEFAULT_ENCODE_SET).collect(); + let scopes: String = utf8_percent_encode(&scopes, NON_ALPHANUMERIC).collect(); let url = if self.force_login { format!( "{}/oauth/authorize?client_id={}&redirect_uri={}&scope={}&force_login=true&\