Skip to content

Commit f426ee9

Browse files
brechtvljolheiser
authored andcommitted
Fix invalid issue branch reference if not specified in template (go-gitea#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 .
1 parent 4b3e456 commit f426ee9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routers/web/repo/issue.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,8 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
786786
}
787787

788788
}
789-
if !strings.HasPrefix(template.Ref, "refs/") { // Assume that the ref intended is always a branch - for tags users should use refs/tags/<ref>
789+
790+
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>
790791
template.Ref = git.BranchPrefix + template.Ref
791792
}
792793
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0

0 commit comments

Comments
 (0)