From f87a138d4988e92a498a1b438a54545439c9eb91 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 21:23:36 -0800 Subject: [PATCH] Better matching for links in statuses --- bookwyrm/outgoing.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py index 88377d33..f247b428 100644 --- a/bookwyrm/outgoing.py +++ b/bookwyrm/outgoing.py @@ -296,8 +296,7 @@ def find_mentions(content): def to_markdown(content): ''' catch links and convert to markdown ''' content = re.sub( - r'([^(href=")])(https?:\/\/([A-Za-z\.\-_\/]+' \ - r'\.[A-Za-z]{2,}[A-Za-z\.\-_\/]+))', + r'([^(href=")]|^)(https?:\/\/([\w\.\-_]+\.[a-z]{2,}(\/[\w\.\-_\/]+)?))', r'\g<1>\g<3>', content) content = markdown(content)