From 863256fd5503d73c140ba91f5cd2140de9c5f713 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 21 May 2024 18:06:37 +0200 Subject: [PATCH] ignore encrypted items during discovery when encryption is disabled when we know a folder should be encrypted but encryption client side app is disabled, ignore any items in the encrypted folders Signed-off-by: Matthieu Gallien --- src/libsync/discovery.cpp | 7 +++++++ src/libsync/discoveryphase.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 91d717c0f..1e276ad68 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1664,6 +1664,13 @@ void ProcessDirectoryJob::processFileFinalize( const SyncFileItemPtr &item, PathTuple path, bool recurse, QueryMode recurseQueryLocal, QueryMode recurseQueryServer) { + if (item->isEncrypted() && !_discoveryData->_account->capabilities().clientSideEncryptionAvailable()) { + item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_IGNORE; + item->_direction = SyncFileItem::None; + emit _discoveryData->itemDiscovered(item); + return; + } + // Adjust target path for virtual-suffix files if (isVfsWithSuffix()) { if (item->_type == ItemTypeVirtualFile) { diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index c08cd8261..ca96b8c82 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -623,10 +623,13 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot() emit finished(HttpError{ 0, _error }); deleteLater(); return; - } else if (isE2eEncrypted()) { + } else if (isE2eEncrypted() && _account->capabilities().clientSideEncryptionAvailable()) { emit etag(_firstEtag, QDateTime::fromString(QString::fromUtf8(_lsColJob->responseTimestamp()), Qt::RFC2822Date)); fetchE2eMetadata(); return; + } else if (isE2eEncrypted() && !_account->capabilities().clientSideEncryptionAvailable()) { + emit etag(_firstEtag, QDateTime::fromString(QString::fromUtf8(_lsColJob->responseTimestamp()), Qt::RFC2822Date)); + emit finished(_results); } emit etag(_firstEtag, QDateTime::fromString(QString::fromUtf8(_lsColJob->responseTimestamp()), Qt::RFC2822Date)); emit finished(_results);