mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Gracefully handle bare repositories on API operations. (#1932)
Signed-off-by: Dennis Keitzel <github@pinshot.net>
This commit is contained in:
@@ -20,6 +20,11 @@ func GetRawFile(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
ctx.Status(404)
|
||||
return
|
||||
}
|
||||
|
||||
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath)
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
|
Reference in New Issue
Block a user