Propfind: Treat broken XML response as failure #4575

Soldiering on with a broken or incomplete response could lead to
incorrect sync behavior.

Since discovery uses LsCol jobs which already handle errors
correctly, this should not have a significant impact.
This commit is contained in:
Christian Kamm 2016-03-17 10:29:35 +01:00
parent 254361cb87
commit 4b19cdeca0
2 changed files with 7 additions and 2 deletions

View File

@ -265,7 +265,7 @@ QString extractErrorMessage(const QByteArray& errorResponse)
}
QString exception;
while (!reader.atEnd() && reader.error() == QXmlStreamReader::NoError) {
while (!reader.atEnd() && !reader.hasError()) {
reader.readNextStartElement();
if (reader.name() == QLatin1String("message")) {
QString message = reader.readElementText();

View File

@ -558,7 +558,12 @@ bool PropfindJob::finished()
}
}
}
emit result(items);
if (reader.hasError()) {
qDebug() << "PROPFIND request XML parser error: " << reader.errorString();
emit finishedWithError(reply());
} else {
emit result(items);
}
} else {
qDebug() << "PROPFIND request *not* successful, http result code is" << http_result_code
<< (http_result_code == 302 ? reply()->header(QNetworkRequest::LocationHeader).toString() : QLatin1String(""));