udsy19 opened a new pull request, #74940:
URL: https://github.com/apache/airflow/pull/74940

   ## Why
   
   `DiscordCommonHandler.validate_embed` checks the embed **author name** 
against a `> 2048` limit, but Discord's documented embed author-name limit is 
**256** — and the error message on the very next line already says *"256 or 
fewer characters"*:
   
   ```python
   if "author" in embed:
       if len(embed["author"]["name"]) > 2048:   # should be 256
           raise ValueError("Discord embed author name must be 256 or fewer 
characters")
   ```
   
   The `2048` was copied from the footer-text check directly above (where 
`2048` is correct). Every sibling 256-char check (`title`, field `name`) 
correctly uses `> 256`; only `author.name` was wrong.
   
   `validate_embed` exists to reject oversized embeds locally with a clear 
message before the webhook call. With the wrong bound, an author name of 
257–2048 characters silently passes local validation and is instead rejected 
downstream by Discord's API with a less helpful error — defeating the purpose 
of the local check and contradicting both the function's own error text and the 
[Discord embed-limits 
spec](https://discord.com/developers/docs/resources/message#embed-object-embed-limits)
 it cites.
   
   ## What
   
   `> 2048` → `> 256` for the author name.
   
   ## Tests
   
   The existing parametrized `fail-on-author-name` case used `"t" * 2049`, 
which exceeds even the buggy `2048` bound and so never exercised the defect. 
Tightened to `"t" * 257` (limit + 1), matching the sibling 256-limit cases. 
Verified fail-on-revert on the real `validate_embed`: a 257-char name is 
rejected only after the fix (256 is accepted at the boundary); reverted, the 
257-char name passes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to