Repair E2EE uploads
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 1 Dec 2020 11:33:29 +0000 (12:33 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:21 +0000 (10:59 +0100)
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/propagateupload.cpp
src/libsync/propagateuploadng.cpp
src/libsync/propagateuploadv1.cpp

index 8956397c8e392801ecbd803418d055cfba0a5822..1229110378eeae89f29a7058133f111593b8ee3f 100644 (file)
@@ -370,7 +370,7 @@ void PropagateUploadFileCommon::slotComputeContentChecksum()
         this, &PropagateUploadFileCommon::slotComputeTransmissionChecksum);
     connect(computeChecksum, &ComputeChecksum::done,
         computeChecksum, &QObject::deleteLater);
-    computeChecksum->start(filePath);
+    computeChecksum->start(_fileToUpload._path);
 }
 
 void PropagateUploadFileCommon::slotComputeTransmissionChecksum(const QByteArray &contentChecksumType, const QByteArray &contentChecksum)
@@ -397,8 +397,7 @@ void PropagateUploadFileCommon::slotComputeTransmissionChecksum(const QByteArray
         this, &PropagateUploadFileCommon::slotStartUpload);
     connect(computeChecksum, &ComputeChecksum::done,
         computeChecksum, &QObject::deleteLater);
-    const QString filePath = propagator()->fullLocalPath(_item->_file);
-    computeChecksum->start(filePath);
+    computeChecksum->start(_fileToUpload._path);
 }
 
 void PropagateUploadFileCommon::slotStartUpload(const QByteArray &transmissionChecksumType, const QByteArray &transmissionChecksum)
@@ -414,7 +413,7 @@ void PropagateUploadFileCommon::slotStartUpload(const QByteArray &transmissionCh
         _item->_checksumHeader = _transmissionChecksumHeader;
     }
 
-    const QString fullFilePath = propagator()->fullLocalPath(_fileToUpload._file);
+    const QString fullFilePath = _fileToUpload._path;
     const QString originalFilePath = propagator()->fullLocalPath(_item->_file);
 
     if (!FileSystem::fileExists(fullFilePath)) {
@@ -439,9 +438,8 @@ void PropagateUploadFileCommon::slotStartUpload(const QByteArray &transmissionCh
         return;
     }
 
-    qint64 fileSize = FileSystem::getSize(fullFilePath);
-    _item->_size = fileSize;
-    _fileToUpload._size = fileSize;
+    _fileToUpload._size = FileSystem::getSize(fullFilePath);
+    _item->_size = FileSystem::getSize(originalFilePath);
 
     // But skip the file if the mtime is too close to 'now'!
     // That usually indicates a file that is still being changed
index 8f9dfe88ed17b409d186af77a7c71d666d76bfdd..e45d09d16bbc2bc56cd020a2ac9431ba24140106 100644 (file)
@@ -316,7 +316,7 @@ void PropagateUploadFileNG::startNextChunk()
         return;
     }
 
-    const QString fileName = propagator()->fullLocalPath(_fileToUpload._file);
+    const QString fileName = _fileToUpload._path;
     auto device = std::make_unique<UploadDevice>(
             fileName, _currentChunk, _currentChunkSize, &propagator()->_bandwidthManager);
     if (!device->open(QIODevice::ReadOnly)) {
index 761964c1b681857dab2d35101ca44f0d067d3bfc..8e4ec1e05e6e023166653cab3d87bbab058de5f0 100644 (file)
@@ -122,7 +122,7 @@ void PropagateUploadFileV1::startNextChunk()
         headers[checkSumHeaderC] = _transmissionChecksumHeader;
     }
 
-    const QString fileName = propagator()->fullLocalPath(_fileToUpload._file);
+    const QString fileName = _fileToUpload._path;
     auto device = std::make_unique<UploadDevice>(
             fileName, chunkStart, currentChunkSize, &propagator()->_bandwidthManager);
     if (!device->open(QIODevice::ReadOnly)) {