aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-06-07 21:50:19 +0200
committerGitHub <noreply@github.com>2020-06-07 22:50:19 +0300
commit20951c5c215bb76385eb70e256e6858c1d53aa05 (patch)
tree3dddaeead898380fd36943567c6ef924a9dd03f9
parent99f7ec8f451e3556ad3549287b078dfb358df3ec (diff)
downloadgitea-20951c5c215bb76385eb70e256e6858c1d53aa05.tar.gz
gitea-20951c5c215bb76385eb70e256e6858c1d53aa05.zip
In File Create/Update API return 404 if Branch does not exist (#11791) (#11795)
* In File Create/Update API return 404 if Branch does not exist (#11791) * v1.12 version ;)
-rw-r--r--routers/api/v1/repo/file.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 73b8e31a44..9754bb7966 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -350,6 +350,10 @@ func handleCreateOrUpdateFileError(ctx *context.APIContext, err error) {
ctx.Error(http.StatusUnprocessableEntity, "Invalid", err)
return
}
+ if git.IsErrBranchNotExist(err) {
+ ctx.Error(http.StatusNotFound, "BranchDoesNotExist", err)
+ return
+ }
ctx.Error(http.StatusInternalServerError, "UpdateFile", err)
}