mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Updates to API 404 responses (#6077)
This commit is contained in:
committed by
techknowlogick
parent
d10a668ffc
commit
cac9e6e760
@@ -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)
|
||||
|
Reference in New Issue
Block a user