From 43f575884600e3456988f71ae7b7ce8d354d78fe Mon Sep 17 00:00:00 2001 From: Emmanuel DESGRIPPES Date: Sun, 27 Aug 2023 11:31:04 +0200 Subject: [PATCH 1/2] Fix ErrorWithStatus bubbling Since 0.10.0 ErrorWithStatus show as html error rendering. This leads to breaking Basic Auth mechanism for instance. The fix considers every ErrorWithStatus must not show details as html. --- src/webserver/http.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webserver/http.rs b/src/webserver/http.rs index 5f03120b..bbb61326 100644 --- a/src/webserver/http.rs +++ b/src/webserver/http.rs @@ -159,6 +159,7 @@ async fn build_response_header_and_stream>( log::debug!("finished query"); continue; } + DbItem::Error(source_err) if matches!(source_err.downcast_ref(), Some(&ErrorWithStatus { status: _ }) ) => return Err(source_err), DbItem::Error(source_err) => head_context.handle_error(source_err).await?, }; match page_context { From e100ff014a9ff268d4275eba0e61aaf862e5fc10 Mon Sep 17 00:00:00 2001 From: Emmanuel DESGRIPPES Date: Sun, 27 Aug 2023 13:14:40 +0200 Subject: [PATCH 2/2] fmt --- src/webserver/http.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/webserver/http.rs b/src/webserver/http.rs index bbb61326..d4eac995 100644 --- a/src/webserver/http.rs +++ b/src/webserver/http.rs @@ -159,7 +159,14 @@ async fn build_response_header_and_stream>( log::debug!("finished query"); continue; } - DbItem::Error(source_err) if matches!(source_err.downcast_ref(), Some(&ErrorWithStatus { status: _ }) ) => return Err(source_err), + DbItem::Error(source_err) + if matches!( + source_err.downcast_ref(), + Some(&ErrorWithStatus { status: _ }) + ) => + { + return Err(source_err) + } DbItem::Error(source_err) => head_context.handle_error(source_err).await?, }; match page_context {