Skip to content

Fix discord webhook 400 status code when description limit is exceeded #34084

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

Merged
merged 6 commits into from
Apr 4, 2025

Conversation

Mopcho
Copy link
Contributor

@Mopcho Mopcho commented Mar 31, 2025

Fixes #34027

Discord does not allow for description bigger than 2048 bytes. If the description is bigger than that it will throw 400 and the event won't appear in discord. To fix that, in the createPayload method we now slice the description to ensure it doesn’t exceed the limit.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 31, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Mar 31, 2025
@Mopcho Mopcho changed the title Fix discord webhook 400 status code on Release message Fix discord webhook 400 status code when description limit is exceeded Mar 31, 2025
@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 Apr 4, 2025
@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Apr 4, 2025
@wxiaoguang wxiaoguang added type/bug backport/v1.23 This PR should be backported to Gitea 1.23 labels Apr 4, 2025
@wxiaoguang wxiaoguang marked this pull request as ready for review April 4, 2025 09:57
@wxiaoguang wxiaoguang mentioned this pull request Apr 4, 2025
@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 Apr 4, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 4, 2025
@lunny lunny enabled auto-merge (squash) April 4, 2025 17:44
@lunny lunny merged commit 013b268 into go-gitea:main Apr 4, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 4, 2025
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Apr 4, 2025
go-gitea#34084)

Fixes [go-gitea#34027](go-gitea#34027)

Discord does not allow for description bigger than 2048 bytes. If the
description is bigger than that it will throw 400 and the event won't
appear in discord. To fix that, in the createPayload method we now slice
the description to ensure it doesn’t exceed the limit.

---------

Co-authored-by: wxiaoguang <[email protected]>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Apr 4, 2025
lunny added a commit that referenced this pull request Apr 5, 2025
#34084) (#34124)

Backport #34084 by @Mopcho

Fixes [#34027](#34027)

Discord does not allow for description bigger than 2048 bytes. If the
description is bigger than that it will throw 400 and the event won't
appear in discord. To fix that, in the createPayload method we now slice
the description to ensure it doesn’t exceed the limit.

---------

Co-authored-by: Mopcho <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 8, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  docs: add Chinese translations for README files (go-gitea#34132)
  Keep file tree view icons consistent with icon theme (go-gitea#33921)
  Make markdown render match GitHub's behavior (go-gitea#34129)
  Remove dead code: RepoRef (go-gitea#34131)
  Correctly handle submodule view and avoid throwing 500 error (go-gitea#34121)
  Use `overflow-wrap: anywhere` to replace `word-break: break-all` (go-gitea#34126)
  Fix markdown render behaviors (go-gitea#34122)
  Refactor dropdown ellipsis (go-gitea#34123)
  Avoid creating unnecessary temporary cat file sub process (go-gitea#33942)
  Fix discord webhook 400 status code when description limit is exceeded (go-gitea#34084)
  Refactor markup render to fix various path problems (go-gitea#34114)
  [skip ci] Updated translations via Crowdin
  Fix invalid version in RPM package path (go-gitea#34112)
  also check default ssh-cert location for host (go-gitea#34099) (go-gitea#34100)
  Fix markdown frontmatter rendering (go-gitea#34102)
  Get changed files based on merge base when checking `pull_request` actions trigger (go-gitea#34106)
  Add `last_committer_date` and `last_author_date` for file contents API (go-gitea#32921)
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this pull request Apr 13, 2025
go-gitea#34084)

Fixes [go-gitea#34027](go-gitea#34027)

Discord does not allow for description bigger than 2048 bytes. If the
description is bigger than that it will throw 400 and the event won't
appear in discord. To fix that, in the createPayload method we now slice
the description to ensure it doesn’t exceed the limit.

---------

Co-authored-by: wxiaoguang <[email protected]>
(cherry picked from commit 013b268)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.23 This PR should be backported to Gitea 1.23 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 type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discord Webhook Error 400
4 participants