Owncloud - virtual files smaller <1KB - problems with syncing
authorHannah von Reth <hannah.vonreth@owncloud.com>
Tue, 1 Dec 2020 15:58:19 +0000 (16:58 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:27 +0000 (10:59 +0100)
The issue was caused by gziped responses not providing a
content lenght header.

Fixes: #8248
src/libsync/propagatedownload.cpp

index 679c5620a39c8584eeb3ba6581e0506708c54f0e..ee44354e2561a7a9a3f10873ff4acf8e60e81b3b 100644 (file)
@@ -205,8 +205,9 @@ void GETFileJob::slotMetaDataChanged()
         return;
     }
 
-    _contentLength = reply()->header(QNetworkRequest::ContentLengthHeader).toLongLong();
-    if (_expectedContentLength != -1 && _contentLength != _expectedContentLength) {
+    bool ok;
+    _contentLength = reply()->header(QNetworkRequest::ContentLengthHeader).toLongLong(&ok);
+    if (ok && _expectedContentLength != -1 && _contentLength != _expectedContentLength) {
         qCWarning(lcGetJob) << "We received a different content length than expected!"
                             << _expectedContentLength << "vs" << _contentLength;
         _errorString = tr("We received an unexpected download Content-Length.");