Commit 26a8ca7f authored by Bharadwaj Raju's avatar Bharadwaj Raju 📚
Browse files

Don't escape notification title text

Notifications don't support markup in title text, so escaping it causes
unintended HTML entities like & to show up instead of the actual
text.
parent 8dae6772
Pipeline #49472 passed with stage
in 5 minutes and 38 seconds
...@@ -88,15 +88,16 @@ void Notification::createKNotification(const NetworkPacket& np) ...@@ -88,15 +88,16 @@ void Notification::createKNotification(const NetworkPacket& np)
} }
QString escapedTitle = m_title.toHtmlEscaped(); QString escapedTitle = m_title.toHtmlEscaped();
// notification title text does not have markup, but in some cases below it is used in body text so we escape it
QString escapedText = m_text.toHtmlEscaped(); QString escapedText = m_text.toHtmlEscaped();
QString escapedTicker = m_ticker.toHtmlEscaped(); QString escapedTicker = m_ticker.toHtmlEscaped();
if (NotificationServerInfo::instance().supportedHints().testFlag(NotificationServerInfo::X_KDE_DISPLAY_APPNAME)) { if (NotificationServerInfo::instance().supportedHints().testFlag(NotificationServerInfo::X_KDE_DISPLAY_APPNAME)) {
m_notification->setTitle(escapedTitle); m_notification->setTitle(m_title);
m_notification->setText(escapedText); m_notification->setText(escapedText);
m_notification->setHint(QStringLiteral("x-kde-display-appname"), m_appName.toHtmlEscaped()); m_notification->setHint(QStringLiteral("x-kde-display-appname"), m_appName.toHtmlEscaped());
} else { } else {
m_notification->setTitle(m_appName.toHtmlEscaped()); m_notification->setTitle(m_appName);
if (m_title.isEmpty() && m_text.isEmpty()) { if (m_title.isEmpty() && m_text.isEmpty()) {
m_notification->setText(escapedTicker); m_notification->setText(escapedTicker);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment