Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog/unreleased/91145
-rw-r--r--src/gui/folder.cpp11
-rw-r--r--src/gui/folder.h3
3 files changed, 13 insertions, 6 deletions
diff --git a/changelog/unreleased/9114 b/changelog/unreleased/9114
new file mode 100644
index 000000000..39afc7d45
--- /dev/null
+++ b/changelog/unreleased/9114
@@ -0,0 +1,5 @@
+Bugfix: Downgrades could trigger deletion of virtual files
+
+We now prevent the downgrade of Windows VFS folders.
+
+https://github.com/owncloud/client/issues/9114
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 31c11ebd9..b6c7afa4f 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -58,6 +58,9 @@ auto versionC()
{
return QStringLiteral("version");
}
+
+constexpr int WinVfsSettingsVersion = 4;
+constexpr int SettingsVersion = 2;
}
namespace OCC {
@@ -1309,11 +1312,9 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)
settings.setValue(QStringLiteral("virtualFilesMode"), Vfs::modeToString(folder.virtualFilesMode));
// Ensure new vfs modes won't be attempted by older clients
- if (folder.virtualFilesMode == Vfs::WindowsCfApi) {
- settings.setValue(versionC(), 3);
- } else {
- settings.setValue(versionC(), 2);
- }
+ const int version = folder.virtualFilesMode == Vfs::WindowsCfApi ? WinVfsSettingsVersion : SettingsVersion;
+ Q_ASSERT(version <= maxSettingsVersion());
+ settings.setValue(versionC(), version);
// Happens only on Windows when the explorer integration is enabled.
if (!folder.navigationPaneClsid.isNull())
diff --git a/src/gui/folder.h b/src/gui/folder.h
index ecd3327a9..3f7d30737 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -90,8 +90,9 @@ public:
* Version 2: introduction of metadata_parent hash in 2.6.0
* (version remains readable by 2.5.1)
* Version 3: introduction of new windows vfs mode in 2.6.0
+ * Version 4: until 2.9.1 windows vfs tried to unregister folders with a different id from windows.
*/
- static int maxSettingsVersion() { return 3; }
+ static int maxSettingsVersion() { return 4; }
/// Ensure / as separator and trailing /.
static QString prepareLocalPath(const QString &path);