mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
Gracefully handle bare repositories on API operations. (#1932)
Signed-off-by: Dennis Keitzel <github@pinshot.net>
This commit is contained in:
parent
f2fcd9dcd8
commit
96b4780727
3 changed files with 12 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue