Skip to content

Commit e0a8965

Browse files
authored
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 .
1 parent aa87b36 commit e0a8965

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: routers/web/repo/issue.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,8 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
784784
}
785785

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

0 commit comments

Comments
 (0)