Skip to content

Commit

Permalink
Propagator: Don't corrupt file with broken webserver owncloud#3373
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Jul 30, 2015
1 parent f01b7bb commit 7fc7925
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7fc7925

Please sign in to comment.