File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ def sanitize_text(text):
1010 if text is None :
1111 return
1212
13- return bleach .clean (text = text )
13+ return bleach .clean (text = text , tags = [] )
1414
1515 @staticmethod
1616 def allow_img_src (tag , name , value ):
Original file line number Diff line number Diff line change @@ -12,11 +12,21 @@ def test_sanitize_text(self):
1212 target_html = '''
1313 Sample text
1414 <script>document.alert('evil')</script>
15+ <b>bold</b>
16+ <h2>sample h2</h2>
17+ <h3>sample h3</h3>
18+ <i>icon</i><p>sentence</p><u>under bar</u>
19+ <b>bold</b><br><blockquote>blockquote</blockquote>
1520 '''
1621
1722 expected_html = '''
1823 Sample text
1924 <script>document.alert('evil')</script>
25+ <b>bold</b>
26+ <h2>sample h2</h2>
27+ <h3>sample h3</h3>
28+ <i>icon</i><p>sentence</p><u>under bar</u>
29+ <b>bold</b><br><blockquote>blockquote</blockquote>
2030 '''
2131
2232 result = TextSanitizer .sanitize_text (target_html )
You can’t perform that action at this time.
0 commit comments