diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-11 01:59:42 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-11 01:59:42 +0800 |
commit | 041d09ef121519691d95d7caa20f8ce4e166e70c (patch) | |
tree | 1449f9fb18845c77f4512304eddb73c180703a12 | |
parent | README.md: Spelling (diff) | |
download | forge-041d09ef121519691d95d7caa20f8ce4e166e70c.tar.gz forge-041d09ef121519691d95d7caa20f8ce4e166e70c.tar.zst forge-041d09ef121519691d95d7caa20f8ce4e166e70c.zip |
repo_tree: Fix panic on empty pathspec
-rw-r--r-- | handle_repo_tree.go | 2 |
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 } |