aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/incoming/web/handlers/repo/raw.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-08-12 11:01:07 +0800
committerRunxi Yu <me@runxiyu.org>2025-09-15 15:19:12 +0800
commiteb82fdb2dc0903e6125014abd64aceab42c8eb35 (patch)
treec07276ba1595c415ebc28943163d88f3e3180254 /forged/internal/incoming/web/handlers/repo/raw.go
parentRemove forge-specific functions from misc (diff)
downloadforge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.tar.gz
forge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.tar.zst
forge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.zip
RefactorHEADmaster
Diffstat (limited to 'forged/internal/incoming/web/handlers/repo/raw.go')
-rw-r--r--forged/internal/incoming/web/handlers/repo/raw.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/forged/internal/incoming/web/handlers/repo/raw.go b/forged/internal/incoming/web/handlers/repo/raw.go
new file mode 100644
index 0000000..8bdfae3
--- /dev/null
+++ b/forged/internal/incoming/web/handlers/repo/raw.go
@@ -0,0 +1,19 @@
+package repo
+
+import (
+ "fmt"
+ "net/http"
+ "strings"
+
+ wtypes "go.lindenii.runxiyu.org/forge/forged/internal/incoming/web/types"
+)
+
+func (h *HTTP) Raw(w http.ResponseWriter, r *http.Request, v wtypes.Vars) {
+ base := wtypes.Base(r)
+ repo := v["repo"]
+ rest := v["rest"]
+ if base.DirMode && rest != "" && !strings.HasSuffix(rest, "/") {
+ rest += "/"
+ }
+ _, _ = fmt.Fprintf(w, "raw: repo=%q path=%q", repo, rest)
+}