style: Applied formatting
CI / All (ubuntu-latest) (push) Failing after 25s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-21 11:24:18 -06:00
parent 3aede58a11
commit 000559bc9d
2 changed files with 6 additions and 7 deletions
+3 -6
View File
@@ -684,8 +684,8 @@ fn parse_paste_input(input: &str) -> Result<(String, Option<String>)> {
} }
if input.starts_with("http://") || input.starts_with("https://") { if input.starts_with("http://") || input.starts_with("https://") {
let parsed = Url::parse(input) let parsed =
.with_context(|| format!("Failed to parse pasted URL: {input}"))?; Url::parse(input).with_context(|| format!("Failed to parse pasted URL: {input}"))?;
let code = parsed let code = parsed
.query_pairs() .query_pairs()
.find(|(k, _)| k == "code") .find(|(k, _)| k == "code")
@@ -1294,10 +1294,7 @@ echo_pkce_in_token_exchange: true
fn parse_paste_input_url_missing_code_fails() { fn parse_paste_input_url_missing_code_fails() {
let err = let err =
parse_paste_input("https://provider.example/oauth/callback?state=xyz").unwrap_err(); parse_paste_input("https://provider.example/oauth/callback?state=xyz").unwrap_err();
assert!( assert!(err.to_string().contains("code"), "unexpected error: {err}");
err.to_string().contains("code"),
"unexpected error: {err}"
);
} }
#[test] #[test]
+3 -1
View File
@@ -1,3 +1,5 @@
use url::Url;
use super::oauth::{OAuthConfig, OAuthFlow, OAuthProvider, TokenRequestFormat}; use super::oauth::{OAuthConfig, OAuthFlow, OAuthProvider, TokenRequestFormat};
pub struct OpenAICompatibleOAuthProvider { pub struct OpenAICompatibleOAuthProvider {
@@ -6,7 +8,7 @@ pub struct OpenAICompatibleOAuthProvider {
} }
fn is_loopback_uri(uri: &str) -> bool { fn is_loopback_uri(uri: &str) -> bool {
url::Url::parse(uri) Url::parse(uri)
.ok() .ok()
.and_then(|u| u.host_str().map(str::to_string)) .and_then(|u| u.host_str().map(str::to_string))
.is_some_and(|host| matches!(host.as_str(), "127.0.0.1" | "localhost" | "[::1]" | "::1")) .is_some_and(|host| matches!(host.as_str(), "127.0.0.1" | "localhost" | "[::1]" | "::1"))