Skip to content

Commit 7ed0cb7

Browse files
authored
git-pages patch drv to fix bug with query-params (#58)
2 parents 376c65c + 23b586d commit 7ed0cb7

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+

‎makemake/git-pages.nix‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
_module.args.pkgs = pkgs;
66
imports = [ ./git-pages-service.nix ];
77
git-pages = {
8-
package = pkgs.git-pages;
8+
package = pkgs.git-pages.overrideAttrs (old: {
9+
patches = (old.patches or [ ]) ++ [ ./0001-Retain-query-params.patch ];
10+
});
911
port = 4000;
1012
caddyPort = null;
1113
metricsPort = 4002;

0 commit comments

Comments
 (0)