mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-28 22:01:24 +00:00
fix: escape the dash in URL regex (#1255)
This commit is contained in:
@@ -34,9 +34,7 @@ class TextWidget(FieldWidget):
|
||||
|
||||
# Regex from https://stackoverflow.com/a/6041965
|
||||
def linkify(text: str):
|
||||
url_pattern = (
|
||||
r"(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-*]*[\w@?^=%&\/~+#-*])"
|
||||
)
|
||||
url_pattern = r"(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#\-*]*[\w@?^=%&\/~+#\-*])" # noqa: E501
|
||||
return re.sub(
|
||||
url_pattern,
|
||||
lambda url: f'<a href="{url.group(0)}">{url.group(0)}</a>',
|
||||
|
||||
Reference in New Issue
Block a user