From 21b4f455c26acd5ce0cf3d0c2606dcece8363ce3 Mon Sep 17 00:00:00 2001 From: Face <69168154+face-hh@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:42:14 +0300 Subject: [PATCH] Update gurt_server.rs --- dns/src/gurt_server.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dns/src/gurt_server.rs b/dns/src/gurt_server.rs index 7669e6d..ae2e83d 100644 --- a/dns/src/gurt_server.rs +++ b/dns/src/gurt_server.rs @@ -339,13 +339,20 @@ async fn serve_static_file(ctx: &ServerContext) -> Result { let path = ctx.path(); log::info!("Static file request for path: '{}'", path); - let file_path = if path == "/" || path == "" { + // Strip query parameters from the path for static file serving + let path_without_query = if let Some(query_pos) = path.find('?') { + &path[..query_pos] + } else { + path + }; + + let file_path = if path_without_query == "/" || path_without_query == "" { "index.html" } else { - if path.starts_with('/') { - &path[1..] + if path_without_query.starts_with('/') { + &path_without_query[1..] } else { - path + path_without_query } }; log::info!("Resolved file_path: '{}'", file_path);