diff options
author | 6543 <6543@obermui.de> | 2020-06-07 19:30:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 18:30:58 +0100 |
commit | 479ef5c3794ed47ac02771816b1c88c9a509cbb7 (patch) | |
tree | bea8e75251325891b64c7fd9890245c317b223e3 /routers | |
parent | 3f3a0817585a2ad80ff5c6036d5bb6e35b082837 (diff) | |
download | gitea-479ef5c3794ed47ac02771816b1c88c9a509cbb7.tar.gz gitea-479ef5c3794ed47ac02771816b1c88c9a509cbb7.zip |
In File Create/Update API return 404 if Branch does not exist (#11791)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/file.go | 4 |
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..a43fdb074e 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 models.IsErrBranchDoesNotExist(err) || git.IsErrBranchNotExist(err) { + ctx.Error(http.StatusNotFound, "BranchDoesNotExist", err) + return + } ctx.Error(http.StatusInternalServerError, "UpdateFile", err) } |