diff options
author | Brecht Van Lommel <brecht@blender.org> | 2023-01-18 22:50:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 16:50:22 -0500 |
commit | e0a8965208f17c8f037e5489d28f1a070e2d8b47 (patch) | |
tree | 43204f92baa8ef3b13301a23947f4445c4fcf96f /routers | |
parent | aa87b3690081261379c6b93488cdd3f3f7b1ef31 (diff) | |
download | gitea-e0a8965208f17c8f037e5489d28f1a070e2d8b47.tar.gz gitea-e0a8965208f17c8f037e5489d28f1a070e2d8b47.zip |
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 .
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/issue.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index b081092c57..59ab717a1d 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -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 |