From 168c21bb2762d32a03e4010ebaee272c2cf52b8e Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 10 May 2025 14:24:24 +0100 Subject: [PATCH] fix: Don't crash when the client URL doesn't have a domain Having a URL with an IP literal, for example, is allowed --- src/api/client/oidc/authorize.rs | 2 +- src/api/client/oidc/login.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/client/oidc/authorize.rs b/src/api/client/oidc/authorize.rs index 56de2f85..9be08e51 100644 --- a/src/api/client/oidc/authorize.rs +++ b/src/api/client/oidc/authorize.rs @@ -44,7 +44,7 @@ pub(crate) async fn authorize( .well_known .client .as_ref() - .map(|s| s.domain().expect("well-known client should be a domain")); + .map(|s| s.host_str().expect("well-known client should have a host")); let hostname = hostname.unwrap_or("Continuwuity"); match oauth.authorization_header() { | None => { diff --git a/src/api/client/oidc/login.rs b/src/api/client/oidc/login.rs index 91454e7f..82c7f39e 100644 --- a/src/api/client/oidc/login.rs +++ b/src/api/client/oidc/login.rs @@ -47,7 +47,7 @@ pub(crate) async fn oidc_login( .well_known .client .as_ref() - .map(|s| s.domain().expect("well-known client should have a domain")); + .map(|s| s.host_str().expect("well-known client should have a host")); let hostname = hostname.unwrap_or("Continuwuity"); let authorization_query: AuthorizationQuery = query.into();