diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 22994011c5fa4..ff05cb9aeb1e4 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -64,6 +64,11 @@ QString e2eeBaseUrl() return QStringLiteral("ocs/v2.php/apps/end_to_end_encryption/api/v1/"); } +QString e2eeBaseUrlForMetadataAndLockUnlock() +{ + return QStringLiteral("ocs/v2.php/apps/end_to_end_encryption/api/v2/"); +} + namespace { constexpr char accountProperty[] = "account"; diff --git a/src/libsync/clientsideencryption.h b/src/libsync/clientsideencryption.h index d88a3b8c88e63..30fb95b45067b 100644 --- a/src/libsync/clientsideencryption.h +++ b/src/libsync/clientsideencryption.h @@ -25,6 +25,7 @@ class ReadPasswordJob; namespace OCC { QString e2eeBaseUrl(); +QString e2eeBaseUrlForMetadataAndLockUnlock(); namespace EncryptionHelper { OWNCLOUDSYNC_EXPORT QByteArray generateRandomFilename(); diff --git a/src/libsync/clientsideencryptionjobs.cpp b/src/libsync/clientsideencryptionjobs.cpp index 6c95ae73e3e27..a491d04990b5e 100644 --- a/src/libsync/clientsideencryptionjobs.cpp +++ b/src/libsync/clientsideencryptionjobs.cpp @@ -33,7 +33,8 @@ namespace OCC { GetMetadataApiJob::GetMetadataApiJob(const AccountPtr& account, const QByteArray& fileId, QObject* parent) -: AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("meta-data/") + fileId, parent), _fileId(fileId) + : AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("meta-data/") + fileId, parent) + , _fileId(fileId) { } @@ -85,7 +86,7 @@ StoreMetaDataApiJob::StoreMetaDataApiJob(const AccountPtr& account, const QByteArray& b64Metadata, const QByteArray &signature, QObject* parent) -: AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("meta-data/") + fileId, parent), +: AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("meta-data/") + fileId, parent), _fileId(fileId), _b64Metadata(b64Metadata), _token(token), @@ -151,7 +152,7 @@ UpdateMetadataApiJob::UpdateMetadataApiJob(const AccountPtr& account, const QByteArray& token, const QByteArray& signature, QObject* parent) -: AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("meta-data/") + fileId, parent) +: AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("meta-data/") + fileId, parent) , _fileId(fileId), _b64Metadata(b64Metadata), _token(token), @@ -223,7 +224,7 @@ UnlockEncryptFolderApiJob::UnlockEncryptFolderApiJob(const AccountPtr& account, const QByteArray& token, SyncJournalDb *journalDb, QObject* parent) - : AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("lock/") + fileId, parent) + : AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("lock/") + fileId, parent) , _fileId(fileId) , _token(token) , _journalDb(journalDb) @@ -289,7 +290,7 @@ bool UnlockEncryptFolderApiJob::finished() DeleteMetadataApiJob::DeleteMetadataApiJob(const AccountPtr& account, const QByteArray& fileId, const QByteArray &token, QObject* parent) -: AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("meta-data/") + fileId, parent), +: AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("meta-data/") + fileId, parent), _fileId(fileId), _token(token) { @@ -326,7 +327,7 @@ LockEncryptFolderApiJob::LockEncryptFolderApiJob(const AccountPtr &account, SyncJournalDb *journalDb, const QSslKey publicKey, QObject *parent) - : AbstractNetworkJob(account, e2eeBaseUrl() + QStringLiteral("lock/") + fileId, parent) + : AbstractNetworkJob(account, e2eeBaseUrlForMetadataAndLockUnlock() + QStringLiteral("lock/") + fileId, parent) , _fileId(fileId) , _journalDb(journalDb) , _publicKey(publicKey) diff --git a/src/libsync/foldermetadata.cpp b/src/libsync/foldermetadata.cpp index d9094657f3556..1aff1e42a1479 100644 --- a/src/libsync/foldermetadata.cpp +++ b/src/libsync/foldermetadata.cpp @@ -115,6 +115,11 @@ void FolderMetadata::initMetadata() void FolderMetadata::setupExistingMetadata(const QByteArray &metadata) { + if (!_isRootEncryptedFolder) { + int a = 5; + a = 6; + } + const auto doc = QJsonDocument::fromJson(metadata); qCDebug(lcCseMetadata()) << "Got existing metadata:" << doc.toJson(QJsonDocument::Compact); @@ -677,6 +682,11 @@ QByteArray FolderMetadata::encryptedMetadata() _encryptedMetadataVersion = latestSupportedMetadataVersion(); + if (!_isRootEncryptedFolder) { + int a = 5; + a = 6; + } + return jsonString; }