File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 44package  repo
55
66import  (
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
2123func  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
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments