Skip to content

Commit 961f49d

Browse files
committed
Escape the dash in the URL regex
1 parent 88d0b47 commit 961f49d

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/tagstudio/qt/mixed/text_field.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ def set_text(self, text: str):
3434

3535
# Regex from https://stackoverflow.com/a/6041965
3636
def linkify(text: str):
37-
url_pattern = (
38-
r"(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-*]*[\w@?^=%&\/~+#-*])"
39-
)
37+
url_pattern = r"(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#\-*]*[\w@?^=%&\/~+#\-*])" # noqa: E501
4038
return re.sub(
4139
url_pattern,
4240
lambda url: f'<a href="{url.group(0)}">{url.group(0)}</a>',

0 commit comments

Comments
 (0)