1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-30 09:41:11 -05:00

Fix invalid issue branch reference if not specified in template (#22513) (#22520)

Backport #22513

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
This commit is contained in:
John Olheiser 2023-01-19 09:39:30 -06:00 committed by GitHub
parent 4b3e456afa
commit fa33271157
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 template.Ref = git.BranchPrefix + template.Ref
} }
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0 ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0