diff --git a/src/api/router/auth.rs b/src/api/router/auth.rs index 6b90c5ff..28d6bc55 100644 --- a/src/api/router/auth.rs +++ b/src/api/router/auth.rs @@ -5,7 +5,6 @@ use axum_extra::{ TypedHeader, }; use conduit::{debug_error, err, warn, Err, Error, Result}; -use http::uri::PathAndQuery; use ruma::{ api::{client::error::ErrorKind, AuthScheme, Metadata}, server_util::authorization::XMatrix, @@ -190,12 +189,11 @@ async fn auth_server(services: &Services, request: &mut Request, body: Option<&C let destination = services.globals.server_name(); let origin = &x_matrix.origin; - #[allow(clippy::or_fun_call)] let signature_uri = request .parts .uri .path_and_query() - .unwrap_or(&PathAndQuery::from_static("/")) + .expect("all requests have a path") .to_string(); let signature: [Member; 1] = [(x_matrix.key.to_string(), Value::String(x_matrix.sig.to_string()))]; diff --git a/src/router/layers.rs b/src/router/layers.rs index a1a70bb8..908105d8 100644 --- a/src/router/layers.rs +++ b/src/router/layers.rs @@ -184,12 +184,20 @@ fn catch_panic(err: Box) -> http::Response(request: &http::Request) -> tracing::Span { - let path = request - .extensions() - .get::() - .map_or_else(|| request.uri().path(), truncated_matched_path); + let path = request.extensions().get::().map_or_else( + || { + request + .uri() + .path_and_query() + .expect("all requests have a path") + .as_str() + }, + truncated_matched_path, + ); - tracing::info_span!("router:", %path) + let method = request.method(); + + tracing::info_span!("router:", %method, %path) } fn truncated_matched_path(path: &MatchedPath) -> &str {