Some cleanups, titles for RDF now HTML escaped.
This commit is contained in:
parent
ad85713fee
commit
c753939fd7
@ -78,8 +78,9 @@ QNetworkReply::NetworkError NetworkFactory::downloadFile(const QString &url,
|
|||||||
|
|
||||||
QNetworkReply::NetworkError reply_error = reply->error();
|
QNetworkReply::NetworkError reply_error = reply->error();
|
||||||
|
|
||||||
qDebug("File '%s' fetched with status %d.",
|
qDebug("File '%s' fetched with status '%s' (code %d).",
|
||||||
qPrintable(url),
|
qPrintable(url),
|
||||||
|
qPrintable(reply->errorString()),
|
||||||
reply_error);
|
reply_error);
|
||||||
|
|
||||||
// Delete needed stuff and exit.
|
// Delete needed stuff and exit.
|
||||||
|
@ -108,13 +108,13 @@ QList<Message> ParsingFactory::parseAsRDF(const QString &data) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Title is empty but description is not.
|
// Title is empty but description is not.
|
||||||
new_message.m_title = TextFactory::stripTags(elem_description.simplified());
|
new_message.m_title = TextFactory::escapeHtml(TextFactory::stripTags(elem_description.simplified()));
|
||||||
new_message.m_contents = elem_description;
|
new_message.m_contents = elem_description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Title is really not empty, description does not matter.
|
// Title is really not empty, description does not matter.
|
||||||
new_message.m_title = TextFactory::stripTags(elem_title);
|
new_message.m_title = TextFactory::escapeHtml(TextFactory::stripTags(elem_title));
|
||||||
new_message.m_contents = elem_description;
|
new_message.m_contents = elem_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
|
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
|
||||||
: BaseNetworkAccessManager(parent) {
|
: BaseNetworkAccessManager(parent) {
|
||||||
|
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
|
||||||
|
this, SLOT(onSslErrors(QNetworkReply*,QList<QSslError>)));
|
||||||
|
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
|
||||||
|
this, SLOT(onAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SilentNetworkAccessManager::~SilentNetworkAccessManager() {
|
SilentNetworkAccessManager::~SilentNetworkAccessManager() {
|
||||||
@ -14,8 +17,10 @@ SilentNetworkAccessManager::~SilentNetworkAccessManager() {
|
|||||||
|
|
||||||
void SilentNetworkAccessManager::onSslErrors(QNetworkReply *reply,
|
void SilentNetworkAccessManager::onSslErrors(QNetworkReply *reply,
|
||||||
const QList<QSslError> &error) {
|
const QList<QSslError> &error) {
|
||||||
qDebug("SSL errors for '%s'.",
|
qDebug("SSL errors for '%s': '%s' (code %d).",
|
||||||
qPrintable(reply->url().toString()));
|
qPrintable(reply->url().toString()),
|
||||||
|
qPrintable(reply->errorString()),
|
||||||
|
(int) reply->error());
|
||||||
|
|
||||||
reply->ignoreSslErrors(error);
|
reply->ignoreSslErrors(error);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ QString TextFactory::escapeHtml(const QString &html) {
|
|||||||
sequences[" "] = ' ';
|
sequences[" "] = ' ';
|
||||||
sequences["±"] = "±";
|
sequences["±"] = "±";
|
||||||
sequences["×"] = "×";
|
sequences["×"] = "×";
|
||||||
|
sequences["'"] = '\'';
|
||||||
|
|
||||||
QList<QString> keys = sequences.uniqueKeys();
|
QList<QString> keys = sequences.uniqueKeys();
|
||||||
QString output = html;
|
QString output = html;
|
||||||
@ -83,6 +84,7 @@ QString TextFactory::deEscapeHtrml(const QString &text) {
|
|||||||
sequences["\""] = """;
|
sequences["\""] = """;
|
||||||
sequences["±"] = "±";
|
sequences["±"] = "±";
|
||||||
sequences["×"] = "×";
|
sequences["×"] = "×";
|
||||||
|
sequences["\'"] = "'";
|
||||||
|
|
||||||
QList<QString> keys = sequences.uniqueKeys();
|
QList<QString> keys = sequences.uniqueKeys();
|
||||||
QString output = text;
|
QString output = text;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user