Skip custom emojis which don't match emoji regexp
Otherwise, emojis containing forbidden symbols (for example, `-`) appear in "emoji selector" on admin/new page, but are not replaced with emoji image on submit. Also add a note to documentation mentioning allowed characters.
This commit is contained in:
committed by
Thomas Sileo
parent
2cc4eda143
commit
d9b9f596d3
@@ -23,6 +23,8 @@ def _load_emojis(root_dir: Path, base_url: str) -> None:
|
||||
mt = mimetypes.guess_type(emoji.name)[0]
|
||||
if mt and mt.startswith("image/"):
|
||||
name = emoji.name.split(".")[0]
|
||||
if not re.match(EMOJI_REGEX, f':{name}:'):
|
||||
continue
|
||||
ap_emoji: "RawObject" = {
|
||||
"type": "Emoji",
|
||||
"name": f":{name}:",
|
||||
|
Reference in New Issue
Block a user