Update the item even if we don't call decryptFile()
authorKevin Ottens <kevin.ottens@nextcloud.com>
Thu, 25 Jun 2020 10:47:32 +0000 (12:47 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 30 Jun 2020 09:29:08 +0000 (11:29 +0200)
This way it makes it usable in a directory context.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/propagatedownloadencrypted.cpp

index ace382d84b452d0ad0e82f9660d08d479c339828..3c23e8fc0d2129eccf7654bca3fd162526e9fee3 100644 (file)
@@ -88,6 +88,9 @@ void PropagateDownloadEncrypted::checkFolderEncryptedMetadata(const QJsonDocumen
   for (const EncryptedFile &file : files) {
     if (encryptedFilename == file.encryptedFilename) {
       _encryptedInfo = file;
+      _item->_encryptedFileName = _item->_file;
+      _item->_file = _item->_file.section(QLatin1Char('/'), 0, -2) + QLatin1Char('/') + _encryptedInfo.originalFilename;
+
       qCDebug(lcPropagateDownloadEncrypted) << "Found matching encrypted metadata for file, starting download";
       emit folderStatusEncrypted();
       return;
@@ -128,13 +131,6 @@ bool PropagateDownloadEncrypted::decryptFile(QFile& tmpFile)
     // Let's fool the rest of the logic into thinking this was the actual download
     tmpFile.setFileName(_tmpOutput.fileName());
 
-    //TODO: This seems what's breaking the logic.
-    // Let's fool the rest of the logic into thinking this is the right name of the DAV file
-    _item->_encryptedFileName = _item->_file;
-    _item->_file = _item->_file.section(QLatin1Char('/'), 0, -2)
-            + QLatin1Char('/') + _encryptedInfo.originalFilename;
-
-
     return true;
 }