Escape HTML Characters in Notifications.

REVIEW: 130114
This commit is contained in:
Nicolas Fella 2017-05-07 20:22:57 +02:00 committed by Albert Vaca
parent f0010763e7
commit ec2b794ffb

View file

@ -82,18 +82,22 @@ KNotification* Notification::createKNotification(bool update, const NetworkPacka
mNotification->setComponentName(QStringLiteral("kdeconnect"));
}
mNotification->setTitle(mAppName);
QString escapedTitle = mTitle.toHtmlEscaped();
QString escapedText = mText.toHtmlEscaped();
QString escapedTicker = mTicker.toHtmlEscaped();
mNotification->setTitle(mAppName.toHtmlEscaped());
if (mTitle.isEmpty() && mText.isEmpty()) {
mNotification->setText(mTicker);
mNotification->setText(escapedTicker);
} else if (mAppName==mTitle) {
mNotification->setText(mText);
mNotification->setText(escapedText);
} else if (mTitle.isEmpty()){
mNotification->setText(mText);
mNotification->setText(escapedText);
} else if (mText.isEmpty()){
mNotification->setText(mTitle);
mNotification->setText(escapedTitle);
} else {
mNotification->setText(mTitle+": "+mText);
mNotification->setText(escapedTitle+": "+escapedText);
}
if (!mHasIcon) {