Main: Be a little more resilient againts .well-known delegation not resolving

This commit is contained in:
networkException 2024-08-23 01:23:07 +02:00
parent af2baa5089
commit 95d6e155c8
Signed by: networkException
GPG key ID: E3877443AE684391

View file

@ -84,7 +84,10 @@ async fn process_media(source: MediaSource, body: Option<String>, server: Option
let client = match server {
Some(ref url) => Client::builder().server_name_or_homeserver_url(url),
None => Client::builder().server_name(server_name),
// NOTE: We know that server_name is not a URL at this point, however if resolving .well-known
// delegation fails falling back to interpreting the server name as the base URL is somewhat
// more resilient. Just had this now.
None => Client::builder().server_name_or_homeserver_url(server_name),
}.build().await?;
debug!("Downloading {} from {}", uri, client.homeserver());