Skip to content

Commit 20951c5

Browse files
authored
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 ;)
1 parent 99f7ec8 commit 20951c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routers/api/v1/repo/file.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ func handleCreateOrUpdateFileError(ctx *context.APIContext, err error) {
350350
ctx.Error(http.StatusUnprocessableEntity, "Invalid", err)
351351
return
352352
}
353+
if git.IsErrBranchNotExist(err) {
354+
ctx.Error(http.StatusNotFound, "BranchDoesNotExist", err)
355+
return
356+
}
353357

354358
ctx.Error(http.StatusInternalServerError, "UpdateFile", err)
355359
}

0 commit comments

Comments
 (0)