[Pkg-owncloud-commits] [owncloud-client] 07/20: Download: Don't store message body if status != 2xx #2280
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Oct 24 20:08:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch sid
in repository owncloud-client.
commit 421177bfafe7de1b2aa75607fddd47874d40e770
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
(cherry picked from commit 705cd571a59d1fba6225f9b11bafd6acd17cd434)
---
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 610c8ac..5cdda12 100644
--- a/src/mirall/propagator_qnam.cpp
+++ b/src/mirall/propagator_qnam.cpp
@@ -425,9 +425,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;
}
@@ -492,13 +498,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;
+ }
}
}
resetTimeout();
--
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