maintain e2ee state even if the server does not support e2ee
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 15 Mar 2023 14:16:18 +0000 (15:16 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 26 Jun 2024 12:49:44 +0000 (12:49 +0000)
might be that the server previously supported e2ee and e2ee folders
exist

so we have to fetch the info to properly handle it on client

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/folderstatusmodel.cpp
src/gui/folderwizard.cpp
src/gui/selectivesyncdialog.cpp
src/libsync/discoveryphase.cpp
src/libsync/owncloudpropagator.cpp

index e21644aecd8f7e261f030f3434b21fbe55cada3c..1d9e3e52a3d325ade662236af88df0d221f877df 100644 (file)
@@ -613,14 +613,12 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent)
 
     const auto job = new LsColJob(_accountState->account(), path);
     info->_fetchingJob = job;
-    auto props = QList<QByteArray>() << "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<QByteArray>() << "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);
index 87bf4e5e48516b03679b5d3f479b79172c2e77f0..d73500a0b954e27365613f13c077e9f8a62e47d5 100644 (file)
@@ -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<QByteArray>() << "resourcetype";
-    if (_account->capabilities().clientSideEncryptionAvailable()) {
-        props << "http://nextcloud.org/ns:is-encrypted";
-    }
+    const auto props = QList<QByteArray>() << "resourcetype"
+                                           << "http://nextcloud.org/ns:is-encrypted";
     job->setProperties(props);
     connect(job, &LsColJob::directoryListingSubfolders,
         this, &FolderWizardRemotePath::slotUpdateDirectories);
index 595fde87c2c7a2a9739cb818a6276525ff21791c..ea313d16eaeffa9810670223e4a0813cef851313 100644 (file)
@@ -109,10 +109,8 @@ void SelectiveSyncWidget::refreshFolders()
 
     auto *job = new LsColJob(_account, _folderPath);
     auto props = QList<QByteArray>() << "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);
index 33516635d9384089354d8ee33916c5e3474c458c..d094b9f423965b5c9b890fc16ce26438d34c503d 100644 (file)
@@ -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"
index 2148c6613675584cbe0e1ea5724554717a2e93e6..069478033f553ffc83381fe1ce5067ca9cc659cb 100644 (file)
@@ -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;
         }