Provide default for empty PathAndQuery (Sentry ID c09f58adf5...)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use axum::RequestPartsExt;
|
||||
use axum_extra::{TypedHeader, headers::Authorization, typed_header::TypedHeaderRejectionReason};
|
||||
use http::uri::PathAndQuery;
|
||||
use ruma::{
|
||||
CanonicalJsonName, CanonicalJsonObject, CanonicalJsonValue,
|
||||
api::federation::authentication::XMatrix,
|
||||
@@ -30,8 +31,8 @@ pub(super) async fn auth_server(
|
||||
.parts
|
||||
.uri
|
||||
.path_and_query()
|
||||
.expect("all requests have a path")
|
||||
.to_string();
|
||||
.map(PathAndQuery::as_str)
|
||||
.unwrap_or("/");
|
||||
|
||||
let signature: [Member; 1] =
|
||||
[(x_matrix.key.as_str().into(), Value::String(x_matrix.sig.to_string()))];
|
||||
@@ -45,7 +46,7 @@ pub(super) async fn auth_server(
|
||||
("method".into(), Value::String(request.parts.method.as_str().into())),
|
||||
("origin".into(), Value::String(origin.as_str().into())),
|
||||
("signatures".into(), Value::Object(signatures.into())),
|
||||
("uri".into(), Value::String(signature_uri)),
|
||||
("uri".into(), Value::String(signature_uri.into())),
|
||||
];
|
||||
|
||||
authorization.into()
|
||||
@@ -55,7 +56,7 @@ pub(super) async fn auth_server(
|
||||
("method".into(), Value::String(request.parts.method.as_str().into())),
|
||||
("origin".into(), Value::String(origin.as_str().into())),
|
||||
("signatures".into(), Value::Object(signatures.into())),
|
||||
("uri".into(), Value::String(signature_uri)),
|
||||
("uri".into(), Value::String(signature_uri.into())),
|
||||
];
|
||||
|
||||
authorization.into()
|
||||
|
||||
@@ -8,6 +8,7 @@ use axum_client_ip::SecureClientIpSource;
|
||||
use http::{
|
||||
HeaderValue, Method, StatusCode,
|
||||
header::{self, HeaderName},
|
||||
uri::PathAndQuery,
|
||||
};
|
||||
use tower::ServiceBuilder;
|
||||
use tower_http::{
|
||||
@@ -239,8 +240,8 @@ fn request_path_str<T>(request: &http::Request<T>) -> &str {
|
||||
request
|
||||
.uri()
|
||||
.path_and_query()
|
||||
.expect("all requests have a path")
|
||||
.as_str()
|
||||
.map(PathAndQuery::as_str)
|
||||
.unwrap_or("/")
|
||||
}
|
||||
|
||||
fn truncated_matched_path(path: &MatchedPath) -> &str {
|
||||
|
||||
Reference in New Issue
Block a user