diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-08-09 16:56:56 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-08-10 15:19:56 +0300 |
commit | 196f0b9828d0f9340ef5b5ab9e2d84b41ec2b833 (patch) | |
tree | a58f54bcf455e799d49b31e32ac631a6d9ba364f /src/common | |
parent | 4bf7947f51deaca186e30dbe73fb0a3a56a562e9 (diff) |
Now that only one account can use a folder use .sync_journal.db again
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/syncjournaldb.cpp | 18 | ||||
-rw-r--r-- | src/common/syncjournaldb.h | 3 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 82b8a03a9..2dc45c4f8 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -104,16 +104,9 @@ SyncJournalDb::SyncJournalDb(const QString &dbFilePath, QObject *parent) } QString SyncJournalDb::makeDbName(const QString &localPath, - const QUrl &remoteUrl, - const QString &remotePath, - const QString &user) + const QString &infix) { - QString journalPath = QStringLiteral(".sync_"); - - QString key = QStringLiteral("%1@%2:%3").arg(user, remoteUrl.toString(), remotePath); - - QByteArray ba = QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Md5); - journalPath += QString::fromLatin1(ba.left(6).toHex()) + QStringLiteral(".db"); + const QString journalPath = QStringLiteral(".sync_") + infix + QStringLiteral(".db"); // If it exists already, the path is clearly usable QFile file(QDir(localPath).filePath(journalPath)); @@ -134,6 +127,13 @@ QString SyncJournalDb::makeDbName(const QString &localPath, return journalPath; } +QString SyncJournalDb::makeDbName(const QString &localPath, const QUrl &remoteUrl, const QString &remotePath, const QString &user) +{ + // legacy name only used by the cmd client + const QString key = QStringLiteral("%1@%2:%3").arg(user, remoteUrl.toString(), remotePath); + return makeDbName(localPath, QString::fromUtf8(QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Md5).left(6).toHex())); +} + bool SyncJournalDb::maybeMigrateDb(const QString &localPath, const QString &absoluteJournalPath) { const QString oldDbName = localPath + QLatin1String(".csync_journal.db"); diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h index 459903d61..86f813b36 100644 --- a/src/common/syncjournaldb.h +++ b/src/common/syncjournaldb.h @@ -50,6 +50,9 @@ public: /// Create a journal path for a specific configuration static QString makeDbName(const QString &localPath, + const QString &infix); + + static QString makeDbName(const QString &localPath, const QUrl &remoteUrl, const QString &remotePath, const QString &user); |