From d75d0eed2d07ac48e7f18c9354cbb53c6a7eaba6 Mon Sep 17 00:00:00 2001 From: lloydmeta Date: Tue, 29 Oct 2024 21:50:42 +0900 Subject: [PATCH] Fix up empty query param handling Signed-off-by: lloydmeta --- server/src/api/routing/handlers.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/api/routing/handlers.rs b/server/src/api/routing/handlers.rs index 29daf50..904945e 100644 --- a/server/src/api/routing/handlers.rs +++ b/server/src/api/routing/handlers.rs @@ -228,7 +228,12 @@ fn ensure_signature_is_valid( .map(|pq| { // lambda axum seems to insert empty query params when handling reqs // as a lambda - pq.as_str().strip_suffix("?").unwrap_or(pq.as_str()) + let pq_as_str = pq.as_str(); + if uri.query().filter(|q| !q.trim().is_empty()).is_some() { + pq_as_str + } else { + pq_as_str.strip_suffix("?").unwrap_or(pq_as_str) + } }) .unwrap_or("") };