diff options
author | Dennis Keitzel <github@pinshot.net> | 2017-06-11 04:57:28 +0200 |
---|---|---|
committer | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-06-10 21:57:28 -0500 |
commit | 96b4780727b49a2c30c640a73751566f60ffc2af (patch) | |
tree | 874c3bd796279cb5e1bf9cc560a07edc3a946673 /routers/api/v1/repo/file.go | |
parent | f2fcd9dcd834b611d2f321829e814a741054c4ea (diff) | |
download | gitea-96b4780727b49a2c30c640a73751566f60ffc2af.tar.gz gitea-96b4780727b49a2c30c640a73751566f60ffc2af.zip |
Gracefully handle bare repositories on API operations. (#1932)
Signed-off-by: Dennis Keitzel <github@pinshot.net>
Diffstat (limited to 'routers/api/v1/repo/file.go')
-rw-r--r-- | routers/api/v1/repo/file.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index 16a31f96c7..9d12a6e136 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -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) { |