mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Avoid returning empty anchors in html
This commit is contained in:
parent
66d05ea860
commit
a1a4464304
1 changed files with 3 additions and 1 deletions
|
@ -211,7 +211,9 @@ def allowlist_html(html: str) -> str:
|
|||
if tag.name == 'table':
|
||||
tag.attrs['class'] = 'table'
|
||||
|
||||
return str(soup)
|
||||
# avoid returning empty anchors
|
||||
re_empty_anchor = re.compile(r'<a href="(.*?)" rel="nofollow ugc" target="_blank"><\/a>')
|
||||
return re_empty_anchor.sub(r'<a href="\1" rel="nofollow ugc" target="_blank">\1</a>', str(soup))
|
||||
|
||||
|
||||
def markdown_to_html(markdown_text) -> str:
|
||||
|
|
Loading…
Add table
Reference in a new issue