Skip to content

Commit ccb16e9

Browse files
authored
fix: escape the dash in URL regex (TagStudioDev#1255)
1 parent 71d9fc6 commit ccb16e9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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)