mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-24 18:10:52 +00:00
Fix discord webhook 400 status code when description limit is exceeded (#34084)
Fixes [#34027](https://github.com/go-gitea/gitea/issues/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 <wxiaoguang@gmail.com> (cherry picked from commit 013b2686fe6d306c4fb800147207b099866683b9)
This commit is contained in:
parent
3e3a109dd2
commit
64cc883ac1
4 changed files with 38 additions and 7 deletions
|
@ -175,7 +175,7 @@ func TestDiscordPayload(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, pl.Embeds, 1)
|
||||
assert.Len(t, pl.Embeds[0].Description, 4096)
|
||||
assert.Len(t, pl.Embeds[0].Description, 2000)
|
||||
})
|
||||
|
||||
t.Run("IssueComment", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue