aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/file.go
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-03-18 21:29:43 -0500
committertechknowlogick <matti@mdranta.net>2019-03-18 22:29:43 -0400
commitcac9e6e7605184f5679b1ebfbe5b5805191d9a53 (patch)
tree459a00974c8eff4f9cad8843b16d2a1f476c5912 /routers/api/v1/repo/file.go
parentd10a668ffc4ed2a81a8a62ee78f0885ede713ddd (diff)
downloadgitea-cac9e6e7605184f5679b1ebfbe5b5805191d9a53.tar.gz
gitea-cac9e6e7605184f5679b1ebfbe5b5805191d9a53.zip
Updates to API 404 responses (#6077)
Diffstat (limited to 'routers/api/v1/repo/file.go')
-rw-r--r--routers/api/v1/repo/file.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 762a0f25d9..929ed00d68 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -40,14 +40,14 @@ func GetRawFile(ctx *context.APIContext) {
// 200:
// description: success
if ctx.Repo.Repository.IsEmpty {
- ctx.Status(404)
+ ctx.NotFound()
return
}
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath)
if err != nil {
if git.IsErrNotExist(err) {
- ctx.Status(404)
+ ctx.NotFound()
} else {
ctx.Error(500, "GetBlobByPath", err)
}
@@ -124,7 +124,7 @@ func GetEditorconfig(ctx *context.APIContext) {
ec, err := ctx.Repo.GetEditorconfig()
if err != nil {
if git.IsErrNotExist(err) {
- ctx.Error(404, "GetEditorconfig", err)
+ ctx.NotFound(err)
} else {
ctx.Error(500, "GetEditorconfig", err)
}
@@ -134,7 +134,7 @@ func GetEditorconfig(ctx *context.APIContext) {
fileName := ctx.Params("filename")
def := ec.GetDefinitionForFilename(fileName)
if def == nil {
- ctx.Error(404, "GetDefinitionForFilename", err)
+ ctx.NotFound(err)
return
}
ctx.JSON(200, def)