Skip to content

Commit

Permalink
Fix safe href domain regex matching tel: protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
Crozzers committed Jul 10, 2023
1 parent 9c6017f commit 28a54c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def _safe_href(self):
# omitted ['"<>] for XSS reasons
less_safe = r'#/\.!#$%&\(\)\+,/:;=\?@\[\]^`\{\}\|~'
# dot seperated hostname, optional port number, not followed by protocol seperator
domain = r'(?:[%s]+(?:\.[%s]+)*)(?::\d+/?)?(?![^:/]*:/*)' % (safe, safe)
domain = r'(?:[%s]+(?:\.[%s]+)+)(?::\d+/?)?(?![^:/]*:/*)' % (safe, safe)
fragment = r'[%s]*' % (safe + less_safe)

return re.compile(r'^(?:(%s)?(%s)(%s)|(#|\.{,2}/)(%s))$' % (self._safe_protocols, domain, fragment, fragment), re.I)
Expand Down

0 comments on commit 28a54c3

Please sign in to comment.