Verify repository is not bare before retrieving blob. (#3996)

pull/3651/merge
cybe 2017-01-27 13:09:25 +01:00 committed by 无闻
parent 8bcc0e392e
commit 740192564b
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,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) {