From 6dc12166ad70943b8221becfd30b541f93e4ca4e Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 25 Jun 2020 12:47:32 +0200 Subject: [PATCH] Update the item even if we don't call decryptFile() This way it makes it usable in a directory context. Signed-off-by: Kevin Ottens --- src/libsync/propagatedownloadencrypted.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libsync/propagatedownloadencrypted.cpp b/src/libsync/propagatedownloadencrypted.cpp index ace382d84..3c23e8fc0 100644 --- a/src/libsync/propagatedownloadencrypted.cpp +++ b/src/libsync/propagatedownloadencrypted.cpp @@ -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; } -- 2.30.2