Merge pull request #1216 from bookwyrm-social/link-formatting

Fixes detection of links with certain characters
This commit is contained in:
Mouse Reeve 2021-07-07 11:20:15 -06:00 committed by GitHub
commit b1022cf245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -150,7 +150,7 @@ def find_mentions(content):
def format_links(content):
"""detect and format links"""
return re.sub(
r'([^(href=")]|^|\()(https?:\/\/(%s([\w\.\-_\/+&\?=:;,])*))' % regex.DOMAIN,
r'([^(href=")]|^|\()(https?:\/\/(%s([\w\.\-_\/+&\?=:;,@#])*))' % regex.DOMAIN,
r'\g<1><a href="\g<2>">\g<3></a>',
content,
)