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:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-09-17 17:54:08 +0300
committerHannah von Reth <vonreth@kde.org>2021-09-21 10:35:35 +0300
commit4951b52ac6d62cf6b2601e908d397063d47c489d (patch)
tree5c3b6848d55e5f1dc99a058f0b132b20f1d33331 /src/gui/folderman.cpp
parent37dbdc9cea118b947dacdae34000967aa7a097a5 (diff)
Fix migration on minor url format changes like…
…https://demo.owncloud.org/ to https://demo.owncloud.org This commit also removed the infix from the cmd client, as it is to unreliable.
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r--src/gui/folderman.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 78b186f8f..da54e3eaf 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -45,6 +45,17 @@ int numberOfSyncJournals(const QString &path)
return QDir(path).entryList({ QStringLiteral(".sync_*.db"), QStringLiteral("._sync_*.db") }, QDir::Hidden | QDir::Files).size();
}
+QString makeLegacyDbName(const OCC::FolderDefinition &def, const OCC::AccountPtr &account)
+{
+ // ensure https://demo.owncloud.org/ matches https://demo.owncloud.org
+ // the empty path was the legacy formating before 2.9
+ auto legacyUrl = account->url();
+ if (legacyUrl.path() == QLatin1String("/")) {
+ legacyUrl.setPath(QString());
+ }
+ const QString key = QStringLiteral("%1@%2:%3").arg(account->credentials()->user(), legacyUrl.toString(), def.targetPath);
+ return OCC::SyncJournalDb::makeDbName(def.localPath, QString::fromUtf8(QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Md5).left(6).toHex()));
+}
}
namespace OCC {
@@ -289,13 +300,13 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
const auto defaultJournalPath = [&account, folderDefinition] {
// if we would have booth the 2.9.0 file name and the lagacy file
// with the md5 infix we prefer the 2.9.0 version
- const QFileInfo info(folderDefinition.localPath);
+ const QDir info(folderDefinition.localPath);
const QString defaultPath = SyncJournalDb::makeDbName(folderDefinition.localPath);
if (info.exists(defaultPath)) {
return defaultPath;
}
// 2.6
- QString legacyPath = SyncJournalDb::makeDbName(folderDefinition.localPath, account->account()->url(), folderDefinition.targetPath, account->account()->credentials()->user());
+ QString legacyPath = makeLegacyDbName(folderDefinition, account->account());
if (info.exists(legacyPath)) {
return legacyPath;
}