This is an automated email from the ASF dual-hosted git repository.
shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ae8c970f12d Fix Discord embed author name length validation using
wrong limit (#74940)
ae8c970f12d is described below
commit ae8c970f12d841614e609c148697d56f43cb8aa2
Author: Udaya Vijay Anand <[email protected]>
AuthorDate: Sun Oct 18 04:08:25 2026 -0400
Fix Discord embed author name length validation using wrong limit (#74940)
DiscordCommonHandler.validate_embed checked the author name against a
2048-character limit, but Discord's embed author name limit is 256 (and
the error message already says "256 or fewer characters"). The 2048 was
copied from the footer-text check, where 2048 is correct. As a result an
author name of 257-2048 characters passed local validation and was only
rejected later by Discord's API with a less helpful error.
The existing regression test used a 2049-character name, which happened
to exceed even the wrong bound and so never caught the defect; tighten it
to 257 to match the 256 limit, consistent with the sibling title and
field-name cases.
Signed-off-by: Udaya Tejas <[email protected]>
---
.../discord/src/airflow/providers/discord/hooks/discord_webhook.py | 2 +-
providers/discord/tests/unit/discord/hooks/test_discord_webhook.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git
a/providers/discord/src/airflow/providers/discord/hooks/discord_webhook.py
b/providers/discord/src/airflow/providers/discord/hooks/discord_webhook.py
index fc2105b377f..d33baf74d5d 100644
--- a/providers/discord/src/airflow/providers/discord/hooks/discord_webhook.py
+++ b/providers/discord/src/airflow/providers/discord/hooks/discord_webhook.py
@@ -88,7 +88,7 @@ class DiscordCommonHandler:
raise ValueError("Discord embed footer text must be 2048 or
fewer characters")
# Validate author
if "author" in embed:
- if len(embed["author"]["name"]) > 2048:
+ if len(embed["author"]["name"]) > 256:
raise ValueError("Discord embed author name must be 256 or
fewer characters")
# Validate fields
if "fields" in embed:
diff --git a/providers/discord/tests/unit/discord/hooks/test_discord_webhook.py
b/providers/discord/tests/unit/discord/hooks/test_discord_webhook.py
index 81af113f7c4..3c5e58f5213 100644
--- a/providers/discord/tests/unit/discord/hooks/test_discord_webhook.py
+++ b/providers/discord/tests/unit/discord/hooks/test_discord_webhook.py
@@ -124,7 +124,7 @@ class TestDiscordCommonHandler:
id="fail-on-fields",
),
pytest.param(
- {"title": "This is a title", "author": {"name": "t" * 2049}},
+ {"title": "This is a title", "author": {"name": "t" * 257}},
pytest.raises(ValueError, match="Discord embed author name
must be 256 or fewer characters"),
id="fail-on-author-name",
),