diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index e032ffd6b5..f3348a152b 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -384,12 +384,9 @@ void PropagateDownloadFile::start() !account->e2e()->isFolderEncrypted(remoteParentPath + '/')) { startAfterIsEncryptedIsChecked(); } else { - const auto slashPosition = remoteFilename.lastIndexOf('/'); - const auto relativeRemoteParentPath = slashPosition >= 0 ? remoteFilename.left(slashPosition) : QString(); - - SyncJournalFileRecord parentRec; - propagator()->_journal->getFileRecordByE2eMangledName(relativeRemoteParentPath, &parentRec); - const auto parentPath = parentRec.isValid() ? parentRec._path : relativeRemoteParentPath; + const auto path = _item->_file; + const auto slashPosition = path.lastIndexOf('/'); + const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString(); _downloadEncryptedHelper = new PropagateDownloadEncrypted(propagator(), parentPath, _item, this); connect(_downloadEncryptedHelper, &PropagateDownloadEncrypted::folderStatusNotEncrypted, [this] { diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 46a078d501..b286c15040 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -134,31 +134,7 @@ void PropagateLocalMkdir::start() if (propagator()->_abortRequested) return; - const auto rootPath = [=]() { - const auto result = propagator()->remotePath(); - if (result.startsWith('/')) { - return result.mid(1); - } else { - return result; - } - }(); - const auto remotePath = QString(rootPath + _item->_file); - const auto remoteParentPath = remotePath.left(remotePath.lastIndexOf('/')); - - const auto account = propagator()->account(); - if (!account->capabilities().clientSideEncryptionAvailable() || - !account->e2e()->isFolderEncrypted(remoteParentPath + '/')) { - startLocalMkdir(); - } else { - const auto relativeRemotePath = _item->_file; - const auto slashPosition = relativeRemotePath.lastIndexOf('/'); - const auto relativeRemoteParentPath = slashPosition >= 0 ? relativeRemotePath.left(slashPosition) : QString(); - - SyncJournalFileRecord parentRec; - propagator()->_journal->getFileRecordByE2eMangledName(relativeRemoteParentPath, &parentRec); - const auto parentPath = parentRec.isValid() ? parentRec._path : relativeRemoteParentPath; - startDemanglingName(parentPath); - } + startLocalMkdir(); } void PropagateLocalMkdir::setDeleteExistingFile(bool enabled) @@ -223,24 +199,6 @@ void PropagateLocalMkdir::startLocalMkdir() done(resultStatus); } -void PropagateLocalMkdir::startDemanglingName(const QString &parentPath) -{ - auto downloadEncryptedHelper = new PropagateDownloadEncrypted(propagator(), parentPath, _item, this); - connect(downloadEncryptedHelper, &PropagateDownloadEncrypted::folderStatusEncrypted, - this, &PropagateLocalMkdir::startLocalMkdir); - connect(downloadEncryptedHelper, &PropagateDownloadEncrypted::folderStatusNotEncrypted, this, [this] { - // We were wrong after all? Actually might happen due to legacy clients creating broken encrypted folders - qCDebug(lcPropagateLocalMkdir) << "Parent of" << _item->_file << "wasn't encrypted, creating with the original name"; - startLocalMkdir(); - }); - connect(downloadEncryptedHelper, &PropagateDownloadEncrypted::failed, [this] { - // This also might happen due to legacy clients creating broken encrypted folders... - qCDebug(lcPropagateLocalMkdir) << "Directory" << _item->_file << "doesn't exist in its parent metadata, creating with the original name"; - startLocalMkdir(); - }); - downloadEncryptedHelper->start(); -} - void PropagateLocalRename::start() { if (propagator()->_abortRequested)