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 <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-06-25 12:47:32 +02:00
parent 2abc3ce2f5
commit 6dc12166ad

View 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;
}