[Pkg-owncloud-commits] [owncloud-client] 16/26: When the temporary file is the same size as the file we would download, just keep it

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Dec 9 00:01:58 UTC 2013


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 09d850bfaaabdb03c47b115ca1b3e90fbb0d1f0d
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Dec 3 14:43:01 2013 +0100

    When the temporary file is the same size as the file we would download, just keep it
    
    Don't download the file if the temporary file is complete.
    
    else, we get error from server: Requested Range not satisfiable
---
 src/mirall/owncloudpropagator.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index 92b10fb..238681f 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -703,11 +703,15 @@ void PropagateDownloadFile::start()
         ne_add_request_header( req.data(), "Accept-Encoding", "gzip" );
 
         if (tmpFile.size() > 0) {
-            char brange[64];
-            ne_snprintf(brange, sizeof brange, "bytes=%lld-", (long long) tmpFile.size());
-            ne_add_request_header(req.data(), "Range", brange);
+            quint64 done = tmpFile.size();
+            if (done == _item._size) {
+                qDebug() << "File is already complete, no need to download";
+                break;
+            }
+            QByteArray rangeRequest = "bytes=" + QByteArray::number(done) +'-';
+            ne_add_request_header(req.data(), "Range", rangeRequest.constData());
             ne_add_request_header(req.data(), "Accept-Ranges", "bytes");
-            qDebug("Retry with range %s", brange);
+            qDebug() << "Retry with range " << rangeRequest;
         }
 
         /* hook called before the content is parsed to set the correct reader,

-- 
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