mirror of
https://gitee.com/gitea/gitea
synced 2025-12-15 04:26:35 +08: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