Skip to content

Commit 724f1ce

Browse files
committed
Added xmpp as an acceptable protocol in links when sanitizing.
- Legacy-Id: 14766
1 parent 5e147af commit 724f1ce

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/utils/html.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead',
1919
'tr', 'tt', 'u', 'ul', 'var')
2020

21+
acceptable_protocols = ['http', 'https', 'mailto', 'xmpp', ]
22+
2123
strip_completely = ['style', 'script', ]
2224

2325
class StripFilter(Filter):
@@ -33,7 +35,7 @@ def __iter__(self):
3335

3436
# Leave the stripping of the strip_completely tags to StripFilter
3537
bleach_tags = list(set(acceptable_tags) | set(strip_completely))
36-
cleaner = bleach.sanitizer.Cleaner(tags=bleach_tags, filters=[StripFilter], strip=True)
38+
cleaner = bleach.sanitizer.Cleaner(tags=bleach_tags, protocols=acceptable_protocols, filters=[StripFilter], strip=True)
3739

3840
def unescape(text):
3941
"""

0 commit comments

Comments
 (0)