From 20951c5c215bb76385eb70e256e6858c1d53aa05 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 7 Jun 2020 21:50:19 +0200 Subject: [PATCH] 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 ;) --- 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 73b8e31a442..9754bb7966b 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) }