1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-09 14:05:53 +00:00

FEP-9098: Shortcode boundaries (#663)

Reviewed-on: https://codeberg.org/fediverse/fep/pulls/663
Co-authored-by: silverpill <silverpill@firemail.cc>
Co-committed-by: silverpill <silverpill@firemail.cc>
This commit is contained in:
silverpill
2025-08-14 00:50:11 +02:00
committed by silverpill
parent 66f36e6c41
commit cd393319e3
+2 -2
View File
@@ -121,11 +121,11 @@ To prevent [Cross-Site Scripting (XSS)][XSS] attacks, implementers MUST ensure t
In order to be compatible with as many servers as possible, implementations SHOULD comply with the following additional requirements:
- Name contains at least two characters ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.3.7/app/models/custom_emoji.rb#L28)).
- Name matches the regular expression `^[a-zA-Z0-9_]+$` ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.3.7/app/models/custom_emoji.rb#L30)).
- Name contains only characters from the `[a-zA-Z0-9_]` set ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.3.7/app/models/custom_emoji.rb#L30)).
- Image media type is `image/png`, `image/gif` or `image/webp` ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.3.7/app/models/custom_emoji.rb#L37)).
- Image size is not greater than 256 KB ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.3.7/app/models/custom_emoji.rb#L27)).
- Image is a square (some clients may display non-squre emojis with a wrong aspect ratio).
- Within a repeated run of emojis (e.g., `:blobcat: :blobcat: :blobcat:`) each shortcode is separated by at least one character that is not in the case-insensitive set `a-z0-9:` ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.4.2/app/models/custom_emoji.rb#L32-L34), see also issue [#7364](https://github.com/mastodon/mastodon/issues/7364)).
- Shortcode is placed between two characters that are not unicode alphanumerics, colons or line endings ([Mastodon](https://github.com/mastodon/mastodon/blob/v4.4.2/app/models/custom_emoji.rb#L32-L34), see also issue [#7364](https://github.com/mastodon/mastodon/issues/7364)).
## Implementations