[Pkg-owncloud-commits] [owncloud-client] 408/498: Propagator: Don't corrupt file with broken webserver #3373

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:11 UTC 2015


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 7fc7925d17df58e6dfb9eb1383f0895d5fadce58
Author: Markus Goetz <markus at woboq.com>
Date:   Thu Jul 30 14:32:33 2015 +0200

    Propagator: Don't corrupt file with broken webserver #3373
---
 src/libsync/propagatedownload.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index c97f19a..e1e4ed4 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -490,6 +490,15 @@ void PropagateDownloadFileQNAM::slotGetFinished()
     const QByteArray sizeHeader("Content-Length");
     quint64 bodySize = job->reply()->rawHeader(sizeHeader).toULongLong();
 
+    if (!job->reply()->rawHeader(sizeHeader).isEmpty() && _tmpFile.size() > 0 && bodySize == 0) {
+        // Strange bug with broken webserver or webfirewall https://github.com/owncloud/client/issues/3373#issuecomment-122672322
+        // This happened when trying to resume a file. The Content-Range header was files, Content-Length was == 0
+        qDebug() << bodySize << _item->_size << _tmpFile.size() << job->resumeStart();
+        _tmpFile.remove();
+        done(SyncFileItem::NormalError, QLatin1String("Broken webserver returning empty content length for non-empty file on resume"));
+        return;
+    }
+
     if(bodySize > 0 && bodySize != _tmpFile.size() - job->resumeStart() ) {
         qDebug() << bodySize << _tmpFile.size() << job->resumeStart();
         _propagator->_anotherSyncNeeded = true;

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