Diff
1diff --git a/pkg/web/goget.go b/pkg/web/goget.go
2index 28a7857f32e07e682a780a7d9b08c9fa3c61a602..298249c877d02dda85121e7cba5e07f8fa46673f 100644
3--- a/pkg/web/goget.go
4+++ b/pkg/web/goget.go
5@@ -5,6 +5,7 @@ import (
6 "net/http"
7 "net/url"
8 "path"
9+ "strings"
10 "text/template"
11
12 "charm.land/log/v2"
13@@ -41,9 +42,20 @@ Redirecting to docs at <a href="https://godoc.org/{{ .ImportRoot }}/{{ .Repo }}"
14 // GoGetController registers Go import metadata routes.
15 func GoGetController(_ context.Context, r *mux.Router) {
16 basePrefix := "/{repo:.*}"
17- r.Handle(basePrefix, withParams(withAccess(http.HandlerFunc(GoGetHandler)))).
18+ r.Handle(basePrefix, withParams(withCaller(http.HandlerFunc(GoGetHandler)))).
19 Methods(http.MethodGet).
20- Queries("go-get", "1")
21+ Queries("go-get", "1").
22+ MatcherFunc(func(r *http.Request, _ *mux.RouteMatch) bool {
23+ return !isGitHTTPPath(r.URL.Path)
24+ })
25+}
26+
27+func isGitHTTPPath(path string) bool {
28+ return strings.Contains(path, ".git/info/") ||
29+ strings.Contains(path, ".git/objects/") ||
30+ strings.HasSuffix(path, "/git-upload-archive") ||
31+ strings.HasSuffix(path, "/git-upload-pack") ||
32+ strings.HasSuffix(path, "/git-receive-pack")
33 }
34
35 // GoGetHandler handles go get requests.
36diff --git a/testscript/testdata/web-ui.txtar b/testscript/testdata/web-ui.txtar
37index df5b9ddd52aea3cec6b4b8500b4a5ccaa311c811..f22ae15b17382c08173eb1a13f036245af8299a6 100644
38--- a/testscript/testdata/web-ui.txtar
39+++ b/testscript/testdata/web-ui.txtar
40@@ -48,7 +48,7 @@ stdout 'public'
41 stdout 'team/nested'
42 stdout 'Public profile content'
43 ! stdout 'private'
44-! stdout 'hidden'
45+! stdout 'href="/hidden"'
46 ! stdout '.soft-serve'
47
48 # Nested overview, tree, source, raw, history, commit, and refs routes work.