Fix msg query and sanitize title of msgs better.

This commit is contained in:
martinrotter 2017-05-18 06:12:28 +02:00
parent 8392dffcf7
commit 18491750fb
2 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,7 @@ QString MessagesModelSqlLayer::formatFields() const {
QString MessagesModelSqlLayer::selectStatement() const {
return QL1S("SELECT ") + formatFields() +
QSL(" FROM Messages LEFT JOIN Feeds ON Messages.feed = Feeds.custom_id WHERE ") +
QSL(" FROM Messages LEFT JOIN Feeds ON Messages.feed = Feeds.custom_id AND Messages.account_id = Feeds.account_id WHERE ") +
m_filter + orderByClause() + QL1C(';');
}

View File

@ -175,7 +175,11 @@ void Feed::run() {
// Also, make sure that HTML encoding, encoding of special characters, etc., is fixed.
msgs[i].m_contents = QUrl::fromPercentEncoding(msgs[i].m_contents.toUtf8());
msgs[i].m_author = msgs[i].m_author.toUtf8();
msgs[i].m_title = QUrl::fromPercentEncoding(msgs[i].m_title.toUtf8());
// 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(" "));
}
emit messagesObtained(msgs, error_during_obtaining);