Skip to content

Commit

Permalink
Switch default to sanitize(encoding=utf8) Fixes #1758 (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmorris authored and mekarpeles committed Dec 25, 2018
1 parent b5d8285 commit 6185655
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openlibrary/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@
]
__docformat__ = "restructuredtext en"

def sanitize(html, encoding = None):
def sanitize(html, encoding = "utf8"):
"""Removes unsafe tags and attributes from html and adds
``rel="nofollow"`` attribute to all external links.
Using encoding=None if passing unicode strings e.g. for Python 3.
encoding="utf8" matches default format for earlier versions of Genshi
https://genshi.readthedocs.io/en/latest/upgrade/#upgrading-from-genshi-0-6-x-to-the-development-version
"""

# Can't sanitize unless genshi module is available
Expand Down

0 comments on commit 6185655

Please sign in to comment.