From 3080b4168771f934a7a17f0f5da356f8ad50da5f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 6 Sep 2025 15:59:08 +0300 Subject: [PATCH] net.http.file: allow for serving requests to static files with cache busting suffixes like `/dist/littlejs.js?1117` --- vlib/net/http/file/static_server.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/net/http/file/static_server.v b/vlib/net/http/file/static_server.v index b611b1d4c9..074720351a 100644 --- a/vlib/net/http/file/static_server.v +++ b/vlib/net/http/file/static_server.v @@ -74,7 +74,7 @@ fn (mut h StaticHttpHandler) handle(req http.Request) http.Response { defer { log.info('took: ${sw.elapsed().microseconds():6}µs, status: ${res.status_code}, size: ${res.body.len:9}, url: ${url}') } - mut uri_path := url.all_after_first('/').trim_right('/') + mut uri_path := url.all_after_first('/').all_before('?').trim_right('/') requested_file_path := os.norm_path(os.real_path(os.join_path_single(h.params.folder, uri_path))) if !requested_file_path.starts_with(h.params.folder) {