From: Christian Kamm Date: Tue, 18 Dec 2018 09:47:45 +0000 (+0100) Subject: Vfs: Ensure older versions gracefully ignore winvfs folders X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~367 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=75b9976526a46f1266a4cb11d5a05010fa913348;p=nextcloud-desktop.git Vfs: Ensure older versions gracefully ignore winvfs folders Previously there'd likely be a mess if a 2.6 winvfs folder was attempted to be used with a 2.5 client. Now the older clients will ignore these folders. --- diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 107e8644f..cca99b8f8 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1247,11 +1247,16 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder) settings.setValue(QLatin1String("targetPath"), folder.targetPath); settings.setValue(QLatin1String("paused"), folder.paused); settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles); - settings.setValue(QLatin1String(versionC), maxSettingsVersion()); settings.setValue(QLatin1String("usePlaceholders"), folder.newFilesAreVirtual); 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(QLatin1String(versionC), 3); + } else { + settings.setValue(QLatin1String(versionC), 2); + } // 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 c8d37da1a..978fa6144 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -78,8 +78,14 @@ public: static bool load(QSettings &settings, const QString &alias, FolderDefinition *folder); - /// The highest version in the settings that load() can read - static int maxSettingsVersion() { return 2; } + /** The highest version in the settings that load() can read + * + * Version 1: initial version (default if value absent in settings) + * 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 + */ + static int maxSettingsVersion() { return 3; } /// Ensure / as separator and trailing /. static QString prepareLocalPath(const QString &path);