aboutsummaryrefslogtreecommitdiff
path: root/handle_repo_tree.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-11 01:59:42 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-11 01:59:42 +0800
commit041d09ef121519691d95d7caa20f8ce4e166e70c (patch)
tree1449f9fb18845c77f4512304eddb73c180703a12 /handle_repo_tree.go
parentREADME.md: Spelling (diff)
downloadforge-041d09ef121519691d95d7caa20f8ce4e166e70c.tar.gz
forge-041d09ef121519691d95d7caa20f8ce4e166e70c.tar.zst
forge-041d09ef121519691d95d7caa20f8ce4e166e70c.zip
repo_tree: Fix panic on empty pathspec
Diffstat (limited to 'handle_repo_tree.go')
-rw-r--r--handle_repo_tree.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/handle_repo_tree.go b/handle_repo_tree.go
index 26d7fd6..4c3eaa1 100644
--- a/handle_repo_tree.go
+++ b/handle_repo_tree.go
@@ -87,7 +87,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) {
}
}
- if raw_path_spec[len(raw_path_spec) - 1] != '/' {
+ if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec) - 1] != '/' {
http.Redirect(w, r, path.Base(path_spec) + "/", http.StatusSeeOther)
return
}