-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanitize markdown in GitHub entity titles #164
base: main
Are you sure you want to change the base?
Conversation
@@ -43,7 +44,8 @@ async def load_emojis() -> None: | |||
|
|||
|
|||
def _format_mention(entity: Entity, kind: EntityKind) -> str: | |||
headline = ENTITY_TEMPLATE.format(kind=kind, entity=entity) | |||
title = escape_special(entity.title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I should inline this; I liked the formatting with the new title
variable more, and it's more consistent with the rest of them, so I kept it this way. Let me know if you want it changed.
@@ -101,3 +106,24 @@ async def remove_view_after_timeout( | |||
await asyncio.sleep(timeout) | |||
with suppress(discord.NotFound, discord.HTTPException): | |||
await message.edit(view=None) | |||
|
|||
|
|||
def escape_special(s: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: for some performance characteristics, there are five regexes run in this function.
Closes #149.
Continuation of #156, thank you GitHub.