Skip to content

Commit

Permalink
Sanitize tag ref for gitea/forgejo (woodpecker-ci#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored and 6543 committed Sep 5, 2024
1 parent 68c7882 commit 98f84ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/forge/gitea/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ func pipelineFromTag(hook *pushHook) *model.Pipeline {
hook.Repo.HTMLURL,
fixMalformedAvatar(hook.Sender.AvatarURL),
)
ref := strings.TrimPrefix(hook.Ref, "refs/tags/")

return &model.Pipeline{
Event: model.EventTag,
Commit: hook.Sha,
Ref: fmt.Sprintf("refs/tags/%s", hook.Ref),
ForgeURL: fmt.Sprintf("%s/src/tag/%s", hook.Repo.HTMLURL, hook.Ref),
Message: fmt.Sprintf("created tag %s", hook.Ref),
Ref: fmt.Sprintf("refs/tags/%s", ref),
ForgeURL: fmt.Sprintf("%s/src/tag/%s", hook.Repo.HTMLURL, ref),
Message: fmt.Sprintf("created tag %s", ref),
Avatar: avatar,
Author: hook.Sender.UserName,
Sender: hook.Sender.UserName,
Expand Down

0 comments on commit 98f84ef

Please sign in to comment.