From 041d09ef121519691d95d7caa20f8ce4e166e70c Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 11 Feb 2025 01:59:42 +0800 Subject: [PATCH] repo_tree: Fix panic on empty pathspec --- handle_repo_tree.go | 2 +- diff --git a/handle_repo_tree.go b/handle_repo_tree.go index 26d7fd6098f9f3b1d51c5caf82e310a78d290f11..4c3eaa1928596ec6fd583daf6a22d3f5d6ccd316 100644 --- a/handle_repo_tree.go +++ b/handle_repo_tree.go @@ -87,7 +87,7 @@ return } } - 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 } -- 2.48.1