refactor: Fix errors in api/server/well_known.rs

This commit is contained in:
Ginger
2026-04-13 13:17:59 -04:00
parent e7a1c71a25
commit 0f64e6b49c
+6 -6
View File
@@ -1,6 +1,6 @@
use axum::extract::State;
use conduwuit::{Error, Result};
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
use conduwuit::{Err, Result};
use ruma::api::federation::discovery::discover_homeserver;
use crate::Ruma;
@@ -11,10 +11,10 @@ pub(crate) async fn well_known_server(
State(services): State<crate::State>,
_body: Ruma<discover_homeserver::Request>,
) -> Result<discover_homeserver::Response> {
Ok(discover_homeserver::Response {
server: match services.server.config.well_known.server.as_ref() {
Ok(discover_homeserver::Response::new(
match services.server.config.well_known.server.as_ref() {
| Some(server_name) => server_name.to_owned(),
| None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")),
| None => return Err!(Request(NotFound("No well-known server URL is configured."))),
},
})
))
}