diff --git a/src/pretix/base/templatetags/rich_text.py b/src/pretix/base/templatetags/rich_text.py index 7e860a48e..2e85f8923 100644 --- a/src/pretix/base/templatetags/rich_text.py +++ b/src/pretix/base/templatetags/rich_text.py @@ -101,7 +101,8 @@ def truelink_callback(attrs, new=False): https://maps.google.com """ text = re.sub('[^a-zA-Z0-9.-/_]', '', attrs.get('_text')) # clean up link text - if URL_RE.match(text): + href_url = urllib.parse.urlparse(attrs[None, 'href']) + if URL_RE.match(text) and href_url.scheme not in ('tel', 'mailto'): # link text looks like a url if text.startswith('//'): text = 'https:' + text @@ -109,7 +110,6 @@ def truelink_callback(attrs, new=False): text = 'https://' + text text_url = urllib.parse.urlparse(text) - href_url = urllib.parse.urlparse(attrs[None, 'href']) if text_url.netloc != href_url.netloc or not href_url.path.startswith(href_url.path): # link text contains an URL that has a different base than the actual URL attrs['_text'] = attrs[None, 'href'] diff --git a/src/tests/base/test_rich_text.py b/src/tests/base/test_rich_text.py index 3533b1d97..4bd034bb5 100644 --- a/src/tests/base/test_rich_text.py +++ b/src/tests/base/test_rich_text.py @@ -15,7 +15,7 @@ from pretix.base.templatetags.rich_text import ( ("[Foo](/foo)", 'Foo'), ("mail@example.org", - 'mailto:mail@example.org'), + 'mail@example.org'), # Test truelink_callback ('Evil Site', 'Evil Site'),