Reduce interaction with e2ee folders when in the wizard
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 30 Jun 2020 16:18:06 +0000 (18:18 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Wed, 1 Jul 2020 16:58:29 +0000 (16:58 +0000)
During the wizard we currently don't have much information about the
encrypted folders. In particular we can only display their mangled names
which is far from ideal for the user to make an informed choice.

That's why in the wizard we now forbid creation of subfolders in e2ee
folders and we also don't display subfolders of e2ee folders.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/folderwizard.cpp
src/gui/selectivesyncdialog.cpp

index 6e1ca4790db319432d610e56a79be0e7842e0255..ee315d82e63876571b66fa68aaee8c0e9c3dc2dc 100644 (file)
@@ -319,6 +319,13 @@ void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list)
     Utility::sortFilenames(sortedList);
     foreach (QString path, sortedList) {
         path.remove(webdavFolder);
+
+        // Don't allow to select subfolders of encrypted subfolders
+        if (_account->capabilities().clientSideEncryptionAvailable() &&
+            _account->e2e()->isAnyParentFolderEncrypted(path)) {
+            continue;
+        }
+
         QStringList paths = path.split('/');
         if (paths.last().isEmpty())
             paths.removeLast();
@@ -344,6 +351,12 @@ void FolderWizardRemotePath::slotCurrentItemChanged(QTreeWidgetItem *item)
 {
     if (item) {
         QString dir = item->data(0, Qt::UserRole).toString();
+
+        // We don't want to allow creating subfolders in encrypted folders outside of the sync logic
+        const auto encrypted = _account->capabilities().clientSideEncryptionAvailable() &&
+                _account->e2e()->isFolderEncrypted(dir + '/');
+        _ui.addFolderButton->setEnabled(!encrypted);
+
         if (!dir.startsWith(QLatin1Char('/'))) {
             dir.prepend(QLatin1Char('/'));
         }
index b302583173f90f77feff197dfb701e51528ff67e..42e69799b98c2c503a5ccb64b23b9334dab5e386 100644 (file)
@@ -248,6 +248,13 @@ void SelectiveSyncWidget::slotUpdateDirectories(QStringList list)
     foreach (QString path, list) {
         auto size = job ? job->_folderInfos[path].size : 0;
         path.remove(pathToRemove);
+
+        // Don't allow to select subfolders of encrypted subfolders
+        if (_account->capabilities().clientSideEncryptionAvailable() &&
+            _account->e2e()->isAnyParentFolderEncrypted(_rootName + '/' + path)) {
+            continue;
+        }
+
         QStringList paths = path.split('/');
         if (paths.last().isEmpty())
             paths.removeLast();