summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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..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)
}