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 Jan 18, 2023
1 parent aa87b36 commit e0a8965
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 @@ -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
}
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
Expand Down

0 comments on commit e0a8965

Please sign in to comment.