mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Rich text: Fix issue with <a> without href=""
This commit is contained in:
@@ -101,7 +101,8 @@ def truelink_callback(attrs, new=False):
|
|||||||
<a href="https://maps.google.com/location/foo">https://maps.google.com</a>
|
<a href="https://maps.google.com/location/foo">https://maps.google.com</a>
|
||||||
"""
|
"""
|
||||||
text = re.sub(r'[^a-zA-Z0-9.\-/_]', '', attrs.get('_text')) # clean up link text
|
text = re.sub(r'[^a-zA-Z0-9.\-/_]', '', attrs.get('_text')) # clean up link text
|
||||||
href_url = urllib.parse.urlparse(attrs[None, 'href'])
|
url = attrs.get((None, 'href'), '/')
|
||||||
|
href_url = urllib.parse.urlparse(url)
|
||||||
if URL_RE.match(text) and href_url.scheme not in ('tel', 'mailto'):
|
if URL_RE.match(text) and href_url.scheme not in ('tel', 'mailto'):
|
||||||
# link text looks like a url
|
# link text looks like a url
|
||||||
if text.startswith('//'):
|
if text.startswith('//'):
|
||||||
|
|||||||
Reference in New Issue
Block a user