From a62905f17a7b5d968d69f2887c173902961772d4 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 27 Oct 2021 12:56:09 +0200 Subject: [PATCH] properly extract the file id when querying server use the proper local file id to get the e2ee meta data Signed-off-by: Matthieu Gallien --- src/libsync/discoveryphase.cpp | 6 +++++- src/libsync/discoveryphase.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 208b6e2ff..5206f7e90 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -351,6 +351,7 @@ void DiscoverySingleDirectoryJob::start() << "getetag" << "http://owncloud.org/ns:size" << "http://owncloud.org/ns:id" + << "http://owncloud.org/ns:fileid" << "http://owncloud.org/ns:downloadURL" << "http://owncloud.org/ns:dDC" << "http://owncloud.org/ns:permissions" @@ -453,6 +454,9 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &fi _dataFingerprint = "[empty]"; } } + if (map.contains(QStringLiteral("fileid"))) { + _localFileId = map.value(QStringLiteral("fileid")).toUtf8(); + } if (map.contains("id")) { _fileId = map.value("id").toUtf8(); } @@ -529,7 +533,7 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot(QNetworkReply *r) void DiscoverySingleDirectoryJob::fetchE2eMetadata() { - auto job = new GetMetadataApiJob(_account, _fileId); + const auto job = new GetMetadataApiJob(_account, _localFileId); connect(job, &GetMetadataApiJob::jsonReceived, this, &DiscoverySingleDirectoryJob::metadataReceived); connect(job, &GetMetadataApiJob::error, diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index ac599a797..a02807341 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -144,6 +144,7 @@ private: QString _subPath; QByteArray _firstEtag; QByteArray _fileId; + QByteArray _localFileId; AccountPtr _account; // The first result is for the directory itself and need to be ignored. // This flag is true if it was already ignored.