In 2.1.4, if Markup.striptags is called, the comment gets replaced by a space. In versions before that it's completely removed from the output.
Test case to reproduce:
import unittest
from markupsafe import Markup
class MarkupSafeTest(unittest.TestCase):
def test_striptags(self):
value = 'x <!-- comment -->'
self.assertEqual(Markup(value).striptags(), 'x')
if __name__ == '__main__':
unittest.main()
With markupsafe 2.1.4 it fails, with 2.1.3 - it passes.
I'm running with Python 3.11
The issue was originally found by running the test_striptags jinja test case with markupsafe 2.1.4:
https://github.com/pallets/jinja/blob/3fd91e4d11bdd131d8c12805177dbe74d85e7b82/tests/test_filters.py#L94
In 2.1.4, if
Markup.striptagsis called, the comment gets replaced by a space. In versions before that it's completely removed from the output.Test case to reproduce:
With markupsafe 2.1.4 it fails, with 2.1.3 - it passes.
I'm running with Python 3.11
The issue was originally found by running the
test_striptagsjinja test case with markupsafe 2.1.4:https://github.com/pallets/jinja/blob/3fd91e4d11bdd131d8c12805177dbe74d85e7b82/tests/test_filters.py#L94