Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use old behavior for telegram webhook #31588

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jul 8, 2024

Fix #31182 (only a quick fix, not quite right)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 8, 2024
@GiteaBot GiteaBot added this to the 1.22.2 milestone Jul 8, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 8, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jul 8, 2024
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 8, 2024
@@ -181,7 +182,7 @@ func (t telegramConvertor) Package(p *api.PackagePayload) (TelegramPayload, erro

func createTelegramPayload(message string) TelegramPayload {
return TelegramPayload{
Message: strings.TrimSpace(message),
Message: markup.Sanitize(strings.TrimSpace(message)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe html.EscapeString() for each fields (author, commit message) is better than santize of final message?
This santizer will not process the commit messages properly... Like that
git commit -am 'Implemented some <a href="https://im.hacker">feature</a>'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the old behavior (I do not want to break too much in 1.22)

The complete fix is in Refactor webhook #31587 , it does what you suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, understood! 👍

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 8, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 9, 2024
@wxiaoguang wxiaoguang merged commit 43c63c3 into go-gitea:release/v1.22 Jul 9, 2024
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-webhook-tg branch July 9, 2024 03:23
wxiaoguang added a commit that referenced this pull request Jul 10, 2024
A more complete fix for #31588

1. Make "generic" code more readable
2. Clarify HTML or Markdown for the payload content
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants