mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Fix invalid issue branch reference if not specified in template (#22513)
When an issue template does not contain a ref, it would end up with an invalid `ref/heads/` value instead of having no branch referenced .
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							aa87b36900
						
					
				
				
					commit
					e0a8965208
				
			@@ -784,7 +784,8 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if !strings.HasPrefix(template.Ref, "refs/") { // Assume that the ref intended is always a branch - for tags users should use refs/tags/<ref>
 | 
					
 | 
				
			||||||
 | 
							if template.Ref != "" && !strings.HasPrefix(template.Ref, "refs/") { // Assume that the ref intended is always a branch - for tags users should use refs/tags/<ref>
 | 
				
			||||||
			template.Ref = git.BranchPrefix + template.Ref
 | 
								template.Ref = git.BranchPrefix + template.Ref
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
 | 
							ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user