Properly sanitize titles of downloaded messages.

This commit is contained in:
martinrotter 2017-05-18 07:43:56 +02:00
parent 18491750fb
commit cccd6ebee2

View File

@ -178,8 +178,10 @@ void Feed::run() {
// Sanitize title. Remove newlines etc.
msgs[i].m_title = QUrl::fromPercentEncoding(msgs[i].m_title.toUtf8())
.remove(QRegExp(QSL("[\\n\\r\\t]")))
.replace(QRegExp(QSL("[]")), QSL(" "));
// Replace all continuous white space.
.replace(QRegExp(QSL("[\\s]{2,}")), QSL(" "))
// Remove all newlines and leading white space.
.remove(QRegExp(QSL("([\\n\\r])|(^\\s)")));
}
emit messagesObtained(msgs, error_during_obtaining);