From: Kevin Ottens Date: Tue, 8 Dec 2020 14:49:29 +0000 (+0100) Subject: No need to fetch encryption data separately before discovery X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~36 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d22046d67970c61f9b4528ccfb255d1cee3fd20e;p=nextcloud-desktop.git No need to fetch encryption data separately before discovery This step isn't necessary anymore, no one looks at ClientSideEncryption for that information anyway. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index d314205b1..9984ad7f7 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -511,69 +511,6 @@ void SyncEngine::startSync() return; } - // If needed, make sure we have up to date E2E information before the - // discovery phase, otherwise we start right away - if (_account->capabilities().clientSideEncryptionAvailable()) { - connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, - this, &SyncEngine::onFolderEncryptedStatusFetchDone); - _account->e2e()->fetchFolderEncryptedStatus(); - } else { - slotStartDiscovery(); - } -} - -void SyncEngine::onFolderEncryptedStatusFetchDone(const QHash &values) -{ - disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, - this, &SyncEngine::onFolderEncryptedStatusFetchDone); - - Q_ASSERT(_remotePath.startsWith('/')); - const auto rootPath = [=]() { - const auto result = _remotePath; - if (result.startsWith('/')) { - return result.mid(1); - } else { - return result; - } - }(); - - std::for_each(values.constKeyValueBegin(), values.constKeyValueEnd(), [=](const std::pair &pair) { - const auto key = pair.first; - const auto value = pair.second; - - if (!key.startsWith(rootPath)) { - return; - } - - Q_ASSERT(key.endsWith('/')); - const auto path = key.mid(rootPath.length()).chopped(1); - - if (path.isEmpty()) { - // We don't store metadata about the root - return; - } - - SyncJournalFileRecord rec; - _journal->getFileRecordByE2eMangledName(path, &rec); - - if (!rec.isValid()) { - _journal->getFileRecord(path, &rec); - } - - if (!rec.isValid()) { - // We don't know that folder yet anyway... - return; - } - - rec._isE2eEncrypted = value; - _journal->setFileRecord(rec); - }); - - slotStartDiscovery(); -} - -void SyncEngine::slotStartDiscovery() -{ bool ok = false; auto selectiveSyncBlackList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); if (ok) { diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 9e23afe88..57e40d49a 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -171,9 +171,6 @@ signals: void seenLockedFile(const QString &fileName); private slots: - void onFolderEncryptedStatusFetchDone(const QHash &values); - void slotStartDiscovery(); - void slotFolderDiscovered(bool local, const QString &folder); void slotRootEtagReceived(const QString &);