diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index e21644aecd8f7..41d363490fd12 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -135,6 +135,9 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const return Qt::ItemIsEnabled; case SubFolder: if (supportsSelectiveSync) { + if (info && info->_isEncrypted && !_accountState->account()->capabilities().clientSideEncryptionAvailable()) { + return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable; + } return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable; } else { return Qt::ItemIsEnabled | Qt::ItemIsSelectable; @@ -613,14 +616,12 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent) const auto job = new LsColJob(_accountState->account(), path); info->_fetchingJob = job; - auto props = QList() << "resourcetype" - << "http://owncloud.org/ns:size" - << "http://owncloud.org/ns:permissions" - << "http://nextcloud.org/ns:is-mount-root" - << "http://owncloud.org/ns:fileid"; - if (_accountState->account()->capabilities().clientSideEncryptionAvailable()) { - props << "http://nextcloud.org/ns:is-encrypted"; - } + const auto props = QList() << "resourcetype" + << "http://owncloud.org/ns:size" + << "http://owncloud.org/ns:permissions" + << "http://nextcloud.org/ns:is-mount-root" + << "http://owncloud.org/ns:fileid" + << "http://nextcloud.org/ns:is-encrypted"; job->setProperties(props); job->setTimeout(60 * 1000); diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 87bf4e5e48516..d73500a0b954e 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -465,10 +465,8 @@ void FolderWizardRemotePath::slotTypedPathFound(const QStringList &subpaths) LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) { auto *job = new LsColJob(_account, path); - auto props = QList() << "resourcetype"; - if (_account->capabilities().clientSideEncryptionAvailable()) { - props << "http://nextcloud.org/ns:is-encrypted"; - } + const auto props = QList() << "resourcetype" + << "http://nextcloud.org/ns:is-encrypted"; job->setProperties(props); connect(job, &LsColJob::directoryListingSubfolders, this, &FolderWizardRemotePath::slotUpdateDirectories); diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index 595fde87c2c7a..ea313d16eaeff 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -109,10 +109,8 @@ void SelectiveSyncWidget::refreshFolders() auto *job = new LsColJob(_account, _folderPath); auto props = QList() << "resourcetype" - << "http://owncloud.org/ns:size"; - if (_account->capabilities().clientSideEncryptionAvailable()) { - props << "http://nextcloud.org/ns:is-encrypted"; - } + << "http://owncloud.org/ns:size" + << "http://nextcloud.org/ns:is-encrypted"; job->setProperties(props); connect(job, &LsColJob::directoryListingSubfolders, this, &SelectiveSyncWidget::slotUpdateDirectories); diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 2cd501a291aa3..858e1b207d9a2 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1661,6 +1661,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 33516635d9384..0041205c6ca62 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -399,7 +399,8 @@ void DiscoverySingleDirectoryJob::start() << "http://owncloud.org/ns:downloadURL" << "http://owncloud.org/ns:dDC" << "http://owncloud.org/ns:permissions" - << "http://owncloud.org/ns:checksums"; + << "http://owncloud.org/ns:checksums" + << "http://nextcloud.org/ns:is-encrypted"; if (_isRootPath) props << "http://owncloud.org/ns:data-fingerprint"; @@ -407,9 +408,6 @@ void DiscoverySingleDirectoryJob::start() // Server older than 10.0 have performances issue if we ask for the share-types on every PROPFIND props << "http://owncloud.org/ns:share-types"; } - if (_account->capabilities().clientSideEncryptionAvailable()) { - props << "http://nextcloud.org/ns:is-encrypted"; - } if (_account->capabilities().filesLockAvailable()) { props << "http://nextcloud.org/ns:lock" << "http://nextcloud.org/ns:lock-owner-displayname" @@ -623,10 +621,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); diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index acaa137c53169..f545edb87e129 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -315,10 +315,6 @@ void PropagateItemJob::slotRestoreJobFinished(SyncFileItem::Status status) bool PropagateItemJob::hasEncryptedAncestor() const { - if (!propagator()->account()->capabilities().clientSideEncryptionAvailable()) { - return false; - } - SyncJournalFileRecord rec; return propagator()->_journal->findEncryptedAncestorForRecord(_item->_file, &rec) && rec.isValid() && rec.isE2eEncrypted(); @@ -1100,8 +1096,7 @@ bool OwncloudPropagator::isDelayedUploadItem(const SyncFileItemPtr &item) const const auto accountPtr = account(); - if (!accountPtr->capabilities().clientSideEncryptionAvailable() || - !parentRec.isValid() || + if (!parentRec.isValid() || !parentRec.isE2eEncrypted()) { return false; }