|
| 1 | +From 831724db61d18f5544a40a2a80f708388f5f023b Mon Sep 17 00:00:00 2001 |
| 2 | +From: phanirithvij <phanirithvij2000@gmail.com> |
| 3 | +Date: Thu, 20 Aug 2026 16:15:11 +0530 |
| 4 | +Subject: [PATCH] Retain query params |
| 5 | + |
| 6 | +Signed-off-by: phanirithvij <phanirithvij2000@gmail.com> |
| 7 | +--- |
| 8 | + src/pages.go | 9 ++++++--- |
| 9 | + 1 file changed, 6 insertions(+), 3 deletions(-) |
| 10 | + |
| 11 | +diff --git a/src/pages.go b/src/pages.go |
| 12 | +index 6e4d3df..7488b08 100644 |
| 13 | +--- a/src/pages.go |
| 14 | ++++ b/src/pages.go |
| 15 | +@@ -164,7 +164,9 @@ func getPage(w http.ResponseWriter, r *http.Request) error { |
| 16 | + ) |
| 17 | + if err == nil { |
| 18 | + if !hasProjectSlash { |
| 19 | +- writeRedirect(w, http.StatusFound, r.URL.Path+"/") |
| 20 | ++ newURL := *r.URL |
| 21 | ++ newURL.Path += "/" |
| 22 | ++ writeRedirect(w, http.StatusFound, newURL.String()) |
| 23 | + return nil |
| 24 | + } |
| 25 | + sitePath, manifest, metadata = projectPath, projectManifest, projectMetadata |
| 26 | +@@ -364,8 +366,9 @@ func getPage(w http.ResponseWriter, r *http.Request) error { |
| 27 | + } else { |
| 28 | + // redirect from `dir` to `dir/`, otherwise when `dir/index.html` is served, |
| 29 | + // links in it will have the wrong base URL |
| 30 | +- newPath := r.URL.Path + "/" |
| 31 | +- writeRedirect(w, http.StatusFound, newPath) |
| 32 | ++ newURL := *r.URL |
| 33 | ++ newURL.Path += "/" |
| 34 | ++ writeRedirect(w, http.StatusFound, newURL.String()) |
| 35 | + return nil |
| 36 | + } |
| 37 | + } else if entry.GetType() == Type_Symlink { |
| 38 | +-- |
| 39 | +2.55.0 |
| 40 | + |
0 commit comments