Fix same-host JMAP redirection on non-standard ports (#2271)

Fixes #2221
This commit is contained in:
Renato Caldas
2025-12-18 13:47:59 +00:00
committed by GitHub
parent c06e88cf7d
commit c28766bd38

View File

@@ -239,13 +239,11 @@ pub async fn name_to_id(client: &Client, name: &str) -> String {
pub fn host(url: &str) -> Option<&str> {
url.split_once("://")
.map(|(_, url)| url.split_once('/').map_or(url, |(host, _)| host))
.map(|host| host.rsplit_once(':').map_or(host, |(host, _)| host))
}
pub fn is_localhost(url: &str) -> bool {
host(url).is_some_and(|host| {
let host = host.rsplit_once(':').map_or(host, |(host, _)| host);
host == "localhost" || host == "127.0.0.1" || host == "[::1]"
})
host(url).is_some_and(|host| host == "localhost" || host == "127.0.0.1" || host == "[::1]")
}
pub trait OAuthResponse {