Added xmpp as an acceptable protocol in links when sanitizing.

- Legacy-Id: 14766
This commit is contained in:
Henrik Levkowetz 2018-03-12 13:17:41 +00:00
parent 5e147af541
commit 724f1ceccc

View file

@ -18,6 +18,8 @@ acceptable_tags = ('a', 'abbr', 'acronym', 'address', 'b', 'big',
'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead',
'tr', 'tt', 'u', 'ul', 'var')
acceptable_protocols = ['http', 'https', 'mailto', 'xmpp', ]
strip_completely = ['style', 'script', ]
class StripFilter(Filter):
@ -33,7 +35,7 @@ class StripFilter(Filter):
# Leave the stripping of the strip_completely tags to StripFilter
bleach_tags = list(set(acceptable_tags) | set(strip_completely))
cleaner = bleach.sanitizer.Cleaner(tags=bleach_tags, filters=[StripFilter], strip=True)
cleaner = bleach.sanitizer.Cleaner(tags=bleach_tags, protocols=acceptable_protocols, filters=[StripFilter], strip=True)
def unescape(text):
"""