Skip to content

Commit 53eb72c

Browse files
committed
Prevent panic on looking at api "git" endpoints for empty repos (go-gitea#22457)
Backport go-gitea#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 go-gitea#22452 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 10c9f96 commit 53eb72c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ func Routes(ctx gocontext.Context) *web.Route {
10421042
m.Get("/blobs/{sha}", repo.GetBlob)
10431043
m.Get("/tags/{sha}", repo.GetAnnotatedTag)
10441044
m.Get("/notes/{sha}", repo.GetNote)
1045-
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode))
1045+
}, context.ReferencesGitRepo(true), reqRepoReader(unit.TypeCode))
10461046
m.Post("/diffpatch", reqRepoWriter(unit.TypeCode), reqToken(), bind(api.ApplyDiffPatchFileOptions{}), repo.ApplyDiffPatch)
10471047
m.Group("/contents", func() {
10481048
m.Get("", repo.GetContentsList)

0 commit comments

Comments
 (0)