Ver Fonte

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

cybe há 8 anos atrás
pai
commit
740192564b
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      routers/api/v1/repo/file.go

+ 5 - 0
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) {