From 6ffb66eea1c38bab9e4d69476c461d42253296e5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 7 Jun 2020 14:14:06 +0200 Subject: [PATCH] API: File Create/Update detect if Branch not exist --- routers/api/v1/repo/file.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index 73b8e31a44217..a43fdb074e2e9 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) }