[Pkg-owncloud-commits] [owncloud-client] 09/211: Download: Don't store message body if status != 2xx #2280
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 705cd571a59d1fba6225f9b11bafd6acd17cd434
Author: Christian Kamm <kamm at incasoftware.de>
Date: Wed Oct 8 14:09:57 2014 +0200
Download: Don't store message body if status != 2xx #2280
---
src/mirall/propagator_qnam.cpp | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/mirall/propagator_qnam.cpp b/src/mirall/propagator_qnam.cpp
index b06a0f9..4dc8fac 100644
--- a/src/mirall/propagator_qnam.cpp
+++ b/src/mirall/propagator_qnam.cpp
@@ -482,9 +482,15 @@ void GETFileJob::start() {
void GETFileJob::slotMetaDataChanged()
{
- if (reply()->error() != QNetworkReply::NoError
- || reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() / 100 != 2) {
- // We will handle the error when the job is finished.
+ int httpStatus = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
+
+ // If the status code isn't 2xx, don't write the reply body to the file.
+ // For any error: handle it when the job is finished, not here.
+ if (httpStatus / 100 != 2) {
+ _device->close();
+ return;
+ }
+ if (reply()->error() != QNetworkReply::NoError) {
return;
}
_etag = get_etag_from_reply(reply());
@@ -554,13 +560,15 @@ void GETFileJob::slotReadyRead()
return;
}
- qint64 w = _device->write(buffer.constData(), r);
- if (w != r) {
- _errorString = _device->errorString();
- _errorStatus = SyncFileItem::NormalError;
- qDebug() << "Error while writing to file" << w << r << _errorString;
- reply()->abort();
- return;
+ if (_device->isOpen()) {
+ qint64 w = _device->write(buffer.constData(), r);
+ if (w != r) {
+ _errorString = _device->errorString();
+ _errorStatus = SyncFileItem::NormalError;
+ qDebug() << "Error while writing to file" << w << r << _errorString;
+ reply()->abort();
+ return;
+ }
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list