Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f93522d

Browse files
authoredJan 15, 2023
Prevent panic on looking at api "git" endpoints for empty repos (#22457) (#22458)
Backport #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 <[email protected]>
1 parent 10c9f96 commit f93522d

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)
Please sign in to comment.