Skip to content

Commit

Permalink
Fix invalid issue branch reference if not specified in template (go-g…
Browse files Browse the repository at this point in the history
…itea#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 .
  • Loading branch information
brechtvl authored and jolheiser committed Jan 19, 2023
1 parent 4b3e456 commit f426ee9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,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
}
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
Expand Down

0 comments on commit f426ee9

Please sign in to comment.