handle escaped characters in markdown mentions

todos-and-issues
Alain St-Denis 2024-02-13 14:04:15 -05:00
rodzic 2509692041
commit d080bcf509
2 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -6,6 +6,7 @@ from typing import List, Set, Union, Dict, Tuple
from bs4 import BeautifulSoup
from commonmark import commonmark
from markdownify import markdownify as md
from marshmallow import missing
from federation.entities.activitypub.enums import ActivityType
@ -262,6 +263,9 @@ class RawContentMixin(BaseEntity):
if handle:
self._mentions.add(handle)
self.raw_content = self.raw_content.replace(mention, '@' + handle)
# mardownify the extracted mention in case some characters are escaped in
# raw_content
self.raw_content = self.raw_content.replace(md(mention), '@' + handle)
class OptionalRawContentMixin(RawContentMixin):

Wyświetl plik

@ -37,6 +37,7 @@ setup(
"lxml>=3.4.0",
"iteration_utilities",
"jsonschema>=2.0.0",
"markdownify",
"pycryptodome>=3.4.10",
"python-dateutil>=2.4.0",
"python-httpsig-socialhome",