From: Kevin Ottens Date: Wed, 15 Jul 2020 11:05:54 +0000 (+0200) Subject: Disable parallelism if we think the parent is e2e X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~69^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c369d33015156a32cb0beadcea2027a9529ae24b;p=nextcloud-desktop.git Disable parallelism if we think the parent is e2e Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index a44e8e93e..d19bcf481 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/src/libsync/propagateremotemkdir.cpp @@ -34,6 +34,33 @@ PropagateRemoteMkdir::PropagateRemoteMkdir(OwncloudPropagator *propagator, const , _uploadEncryptedHelper(nullptr) , _parallelism(FullParallelism) { + const auto rootPath = [=]() { + const auto result = propagator->_remoteFolder; + if (result.startsWith('/')) { + return result.mid(1); + } else { + return result; + } + }(); + const auto path = _item->_file; + const auto slashPosition = path.lastIndexOf('/'); + const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString(); + + SyncJournalFileRecord parentRec; + bool ok = propagator->_journal->getFileRecord(parentPath, &parentRec); + if (!ok) { + done(SyncFileItem::NormalError); + return; + } + + const auto remoteParentPath = parentRec._e2eMangledName.isEmpty() ? parentPath : parentRec._e2eMangledName; + const auto absoluteRemoteParentPath = remoteParentPath.isEmpty() ? rootPath : rootPath + remoteParentPath + '/'; + const auto account = propagator->account(); + + if (account->capabilities().clientSideEncryptionAvailable() && + account->e2e()->isFolderEncrypted(absoluteRemoteParentPath)) { + _parallelism = WaitForFinished; + } } PropagatorJob::JobParallelism PropagateRemoteMkdir::parallelism()