style: Applied formatting
This commit is contained in:
+3
-6
@@ -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]
|
||||||
|
|||||||
@@ -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"))
|
||||||
|
|||||||
Reference in New Issue
Block a user