From d236a931693fccc0a59852cf18833afe24ce09d9 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 26 May 2021 15:45:34 +0530 Subject: [PATCH] chore: Replacing and updating bleach source list * The library bleach-whitelist was deprecated and renamed to bleach-allowlist. * Updated the usages and requirements for the same. --- frappe/utils/html_utils.py | 10 ++++++---- requirements.txt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frappe/utils/html_utils.py b/frappe/utils/html_utils.py index 24def07c63..ccb374fbcc 100644 --- a/frappe/utils/html_utils.py +++ b/frappe/utils/html_utils.py @@ -1,8 +1,10 @@ - -import frappe import json import re -import bleach_whitelist.bleach_whitelist as bleach_whitelist + +from bleach_allowlist import bleach_allowlist + +import frappe + def clean_html(html): import bleach @@ -71,7 +73,7 @@ def sanitize_html(html, linkify=False): tags = (acceptable_elements + svg_elements + mathml_elements + ["html", "head", "meta", "link", "body", "style", "o:p"]) attributes = {"*": acceptable_attributes, 'svg': svg_attributes} - styles = bleach_whitelist.all_styles + styles = bleach_allowlist.all_styles strip_comments = False # returns html with escaped tags, escaped orphan >, <, etc. diff --git a/requirements.txt b/requirements.txt index 769d8c3e7b..b3bfc12567 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ Babel~=2.9.0 beautifulsoup4~=4.9.3 -bleach-whitelist~=0.0.11 +bleach-allowlist~=1.0.3 bleach~=3.3.0 boto3~=1.17.53 braintree~=4.8.0