From 740192564b9d2c14e61cc1ebf910123c3bcbfbc3 Mon Sep 17 00:00:00 2001 From: cybe Date: Fri, 27 Jan 2017 13:09:25 +0100 Subject: Verify repository is not bare before retrieving blob. (#3996) --- routers/api/v1/repo/file.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index ee9d15a3..5da91d9e 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -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) { -- cgit v1.2.3