aboutsummaryrefslogtreecommitdiff
path: root/http_server.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-03 17:53:30 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-03 17:53:30 +0800
commite2a6d73b940bd2a222747f777efc37c3b04b1d16 (patch)
tree784dc0f20336a39ce4d0709a8ccb778a5e248b83 /http_server.go
parentHTTP: Ref type query errors should be 400, not 500 (diff)
downloadforge-e2a6d73b940bd2a222747f777efc37c3b04b1d16.tar.gz
forge-e2a6d73b940bd2a222747f777efc37c3b04b1d16.tar.zst
forge-e2a6d73b940bd2a222747f777efc37c3b04b1d16.zip
HTML: Use the proper repo_url_root in tree/rawtreev0.1.12
Diffstat (limited to 'http_server.go')
-rw-r--r--http_server.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/http_server.go b/http_server.go
index 722ac81..0a474cc 100644
--- a/http_server.go
+++ b/http_server.go
@@ -6,6 +6,7 @@ package main
import (
"errors"
"net/http"
+ "net/url"
"strconv"
"strings"
@@ -184,6 +185,12 @@ func (router *forgeHTTPRouter) ServeHTTP(writer http.ResponseWriter, request *ht
return
}
+ repoURLRoot := "/"
+ for _, part := range segments[:sepIndex+3] {
+ repoURLRoot = repoURLRoot + url.PathEscape(part) + "/"
+ }
+ params["repo_url_root"] = repoURLRoot
+
if len(segments) == sepIndex+3 {
if redirectDir(writer, request) {
return