From 8258dabe4a2b3841cb22e649824ce66cbb3a1609 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 10 Jun 2022 08:00:27 +0800 Subject: [PATCH] fix: query dir param --- src/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index d63d808..c4bbe2e 100644 --- a/src/server.rs +++ b/src/server.rs @@ -191,8 +191,8 @@ impl InnerService { self.handle_render_index(path, headers, &mut res).await?; } else if query == "zip" { self.handle_zip_dir(path, &mut res).await?; - } else if query.starts_with("q=") { - self.handle_query_dir(path, &query[3..], &mut res).await?; + } else if let Some(q) = query.strip_prefix("q=") { + self.handle_query_dir(path, q, &mut res).await?; } else { self.handle_ls_dir(path, true, &mut res).await?; }