loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent panic on looking at api "git" endpoints for empty repos (#22457)

The API endpoints for "git" can panic if they are called on an empty
repo. We can simply allow empty repos for these endpoints without worry
as they should just work.

Fix #22452

Signed-off-by: Andrew Thornton <art27@cantab.net>

authored by

zeripath and committed by
GitHub
cc1f8cbe fe519d86

+1 -1
+1 -1
routers/api/v1/api.go
··· 1061 1061 m.Get("/blobs/{sha}", repo.GetBlob) 1062 1062 m.Get("/tags/{sha}", repo.GetAnnotatedTag) 1063 1063 m.Get("/notes/{sha}", repo.GetNote) 1064 - }, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode)) 1064 + }, context.ReferencesGitRepo(true), reqRepoReader(unit.TypeCode)) 1065 1065 m.Post("/diffpatch", reqRepoWriter(unit.TypeCode), reqToken(), bind(api.ApplyDiffPatchFileOptions{}), repo.ApplyDiffPatch) 1066 1066 m.Group("/contents", func() { 1067 1067 m.Get("", repo.GetContentsList)