diff --git a/bookwyrm/tests/test_sanitize_html.py b/bookwyrm/tests/test_sanitize_html.py index ca1643e8f5..449acdafbe 100644 --- a/bookwyrm/tests/test_sanitize_html.py +++ b/bookwyrm/tests/test_sanitize_html.py @@ -32,14 +32,14 @@ def test_valid_html_invalid_attrs(self): self.assertEqual(output, 'yes html') def test_invalid_html(self): - """remove all html when the html is malformed""" + """don't allow malformed html""" input_text = "yes html" output = clean(input_text) - self.assertEqual("yes html", output) + self.assertEqual("yes html", output) input_text = "yes html " output = clean(input_text) - self.assertEqual("yes html ", output) + self.assertEqual("yes html ", output) def test_disallowed_html(self): """remove disallowed html but keep allowed html""" diff --git a/bookwyrm/utils/sanitizer.py b/bookwyrm/utils/sanitizer.py index 676921949f..f6c87358cb 100644 --- a/bookwyrm/utils/sanitizer.py +++ b/bookwyrm/utils/sanitizer.py @@ -22,4 +22,5 @@ def clean(input_text): "li", ], attributes=["href", "rel", "src", "alt"], + strip=True, )