+7
appview/state/repo.go
+7
appview/state/repo.go
···
21
21
"github.com/bluesky-social/indigo/atproto/syntax"
22
22
securejoin "github.com/cyphar/filepath-securejoin"
23
23
"github.com/go-chi/chi/v5"
24
+
"github.com/go-git/go-git/v5/plumbing"
24
25
"tangled.sh/tangled.sh/core/api/tangled"
25
26
"tangled.sh/tangled.sh/core/appview/auth"
26
27
"tangled.sh/tangled.sh/core/appview/db"
···
248
249
if !s.config.Dev {
249
250
protocol = "https"
250
251
}
252
+
253
+
if !plumbing.IsHash(ref) {
254
+
s.pages.Error404(w)
255
+
return
256
+
}
257
+
251
258
resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/commit/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref))
252
259
if err != nil {
253
260
log.Println("failed to reach knotserver", err)