Merge pull request #19 from dscottboggs/dependabot/cargo/url-2

Update url requirement from 1 to 2
This commit is contained in:
Scott Boggs 2022-12-28 09:47:37 -05:00 committed by GitHub
commit 3dfd7e3e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -25,6 +25,7 @@ url = "1"
hyper-old-types = "0.11.0" hyper-old-types = "0.11.0"
futures-util = "0.3.25" futures-util = "0.3.25"
static_assertions = "1.1.0" static_assertions = "1.1.0"
percent-encoding = "2.2.0"
[dependencies.uuid] [dependencies.uuid]
version = "1.2.2" version = "1.2.2"

View File

@ -1,8 +1,8 @@
use std::borrow::Cow; use std::borrow::Cow;
use log::{as_debug, as_serde, debug, error, trace}; use log::{as_debug, as_serde, debug, error, trace};
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
use reqwest::Client; use reqwest::Client;
use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{
@ -10,10 +10,7 @@ use crate::{
helpers::read_response::read_response, helpers::read_response::read_response,
log_serde, log_serde,
scopes::Scopes, scopes::Scopes,
Data, Data, Error, Mastodon, Result,
Error,
Mastodon,
Result,
}; };
const DEFAULT_REDIRECT_URI: &str = "urn:ietf:wg:oauth:2.0:oob"; const DEFAULT_REDIRECT_URI: &str = "urn:ietf:wg:oauth:2.0:oob";
@ -309,7 +306,7 @@ impl Registered {
/// in a browser. /// in a browser.
pub fn authorize_url(&self) -> Result<String> { pub fn authorize_url(&self) -> Result<String> {
let scopes = format!("{}", self.scopes); 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 { let url = if self.force_login {
format!( format!(
"{}/oauth/authorize?client_id={}&redirect_uri={}&scope={}&force_login=true&\ "{}/oauth/authorize?client_id={}&redirect_uri={}&scope={}&force_login=true&\