diff --git a/securedrop_client/gui/widgets.py b/securedrop_client/gui/widgets.py index da65f8309..7b881d3d5 100644 --- a/securedrop_client/gui/widgets.py +++ b/securedrop_client/gui/widgets.py @@ -442,7 +442,7 @@ def __init__(self, text): super().__init__() layout = QVBoxLayout() self.setLayout(layout) - message = QLabel(html.escape(text)) + message = QLabel(html.escape(text, quote=False)) message.setWordWrap(True) layout.addWidget(message) diff --git a/tests/gui/test_widgets.py b/tests/gui/test_widgets.py index d273c2671..9e1d843c6 100644 --- a/tests/gui/test_widgets.py +++ b/tests/gui/test_widgets.py @@ -497,6 +497,16 @@ def test_SpeechBubble_html_init(): mock_label.assert_called_once_with('<b>hello</b>') +def test_SpeechBubble_with_apostrophe_in_text(): + """Check Speech Bubble is displaying text with apostrophe correctly.""" + with mock.patch('securedrop_client.gui.widgets.QLabel') as mock_label, \ + mock.patch('securedrop_client.gui.widgets.QVBoxLayout'), \ + mock.patch('securedrop_client.gui.widgets.SpeechBubble.setLayout'): + message = "I'm sure, you are reading my message." + SpeechBubble(message) + mock_label.assert_called_once_with(message) + + def test_ConversationWidget_init_left(): """ Check the ConversationWidget is configured correctly for align-left.