aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_index.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http_handle_repo_index.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go
index 15b5173..6ac9b07 100644
--- a/http_handle_repo_index.go
+++ b/http_handle_repo_index.go
@@ -5,6 +5,7 @@ package main
import (
"net/http"
+ "strings"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
@@ -20,9 +21,14 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string
var recent_commits []*object.Commit
var commit_object *object.Commit
var tree *object.Tree
+ var notes []string
repo, repo_name, group_path = params["repo"].(*git.Repository), params["repo_name"].(string), params["group_path"].([]string)
+ if strings.Contains(repo_name, "\n") || slice_contains_newline(group_path) {
+ notes = append(notes, "Path contains newlines; HTTP Git access impossible")
+ }
+
ref_hash, err = get_ref_hash_from_type_and_name(repo, params["ref_type"].(string), params["ref_name"].(string))
if err != nil {
goto no_ref
@@ -48,6 +54,7 @@ no_ref:
params["http_clone_url"] = generate_http_remote_url(group_path, repo_name)
params["ssh_clone_url"] = generate_ssh_remote_url(group_path, repo_name)
+ params["notes"] = notes
render_template(w, "repo_index", params)
}