From 041d09ef121519691d95d7caa20f8ce4e166e70c Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 11 Feb 2025 01:59:42 +0800 Subject: repo_tree: Fix panic on empty pathspec --- handle_repo_tree.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'handle_repo_tree.go') 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 } -- cgit v1.2.3