From 23a759ef4a8545f2ba734ddef2611ca9b8ed2e6e Mon Sep 17 00:00:00 2001 From: Camila San Date: Tue, 10 Apr 2018 15:40:17 +0200 Subject: [PATCH] Adds 304 http status code as valid. Signed-off-by: Camila San --- src/gui/ocsjob.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/ocsjob.cpp b/src/gui/ocsjob.cpp index 6bd55a4336..11e2deffe7 100644 --- a/src/gui/ocsjob.cpp +++ b/src/gui/ocsjob.cpp @@ -106,18 +106,24 @@ bool OcsJob::finished() const QByteArray replyData = reply()->readAll(); QJsonParseError error; + QString message; + int statusCode = 0; auto json = QJsonDocument::fromJson(replyData, &error); + + // when it is null we might have a 304 so get status code from reply() and gives a warning... if (error.error != QJsonParseError::NoError) { + statusCode = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); qCWarning(lcOcs) << "Could not parse reply to" << _verb << Utility::concatUrlPath(account()->url(), path()) << _params << error.errorString() << ":" << replyData; + } else { + statusCode = getJsonReturnCode(json, message); } - QString message; - const int statusCode = getJsonReturnCode(json, message); + //... then it checks for the statusCode if (!_passStatusCodes.contains(statusCode)) { qCWarning(lcOcs) << "Reply to" << _verb @@ -125,6 +131,7 @@ bool OcsJob::finished() << _params << "has unexpected status code:" << statusCode << replyData; emit ocsError(statusCode, message); + } else { // save new ETag value if(reply()->rawHeaderList().contains("ETag"))