Skip to content

Commit 30d4010

Browse files
committed
Some improvements
1 parent 7fd210b commit 30d4010

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

routers/web/repo/issue_dev.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
package repo
55

66
import (
7+
"net/http"
8+
79
git_model "code.gitea.io/gitea/models/git"
810
issues_model "code.gitea.io/gitea/models/issues"
911
access_model "code.gitea.io/gitea/models/perm/access"
@@ -19,6 +21,11 @@ import (
1921
)
2022

2123
func CreateBranchFromIssue(ctx *context.Context) {
24+
if ctx.HasError() { // form binding error check
25+
ctx.JSONError(ctx.GetErrMsg())
26+
return
27+
}
28+
2229
issue := GetActionIssue(ctx)
2330
if ctx.Written() {
2431
return
@@ -56,12 +63,7 @@ func CreateBranchFromIssue(ctx *context.Context) {
5663

5764
canCreateBranch := perm.CanWrite(unit_model.TypeCode) && repo.CanCreateBranch()
5865
if !canCreateBranch {
59-
ctx.NotFound("CreateBranch", nil)
60-
return
61-
}
62-
63-
if ctx.HasError() {
64-
ctx.JSONError(ctx.GetErrMsg())
66+
ctx.Error(http.StatusForbidden, "No permission to create branch in this repository")
6567
return
6668
}
6769

0 commit comments

Comments
 (0)