Skip to content

Commit

Permalink
Do not fail e2ee metadata parsing when current user is not present in…
Browse files Browse the repository at this point in the history
… filedrop.

Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Jan 23, 2024
1 parent 30c9438 commit 031195e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/libsync/foldermetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,6 @@ bool FolderMetadata::parseFileDropPart(const QJsonDocument &doc)
const auto fileDropObject = doc.object().value(filedropKey).toObject();
const auto fileDropMap = fileDropObject.toVariantMap();

auto isFileDropAccessGranted = false;

for (auto it = std::cbegin(fileDropMap); it != std::cend(fileDropMap); ++it) {
const auto fileDropEntryParsed = it.value().toMap();
FileDropEntry fileDropEntry{it.key(),
Expand All @@ -792,19 +790,17 @@ bool FolderMetadata::parseFileDropPart(const QJsonDocument &doc)
return false;
}
fileDropEntry.currentUser = fileDropEntryUser;
isFileDropAccessGranted = true;
break;
}
}
if (!fileDropEntry.isValid()) {
qCDebug(lcCseMetadata()) << "Could not parse filedrop data. fileDropEntry is invalid for userId" << fileDropEntry.currentUser.userId;
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return false;
}
_fileDropEntries.push_back(fileDropEntry);
}

if (!isFileDropAccessGranted) {
_fileDropEntries.clear();
if (fileDropEntry.currentUser.isValid()) {
_fileDropEntries.push_back(fileDropEntry);
}
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/foldermetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class OWNCLOUDSYNC_EXPORT FolderMetadata : public QObject

inline bool isValid() const
{
return !cipherText.isEmpty() && !nonce.isEmpty() && !authenticationTag.isEmpty() && currentUser.isValid();
return !cipherText.isEmpty() && !nonce.isEmpty() && !authenticationTag.isEmpty();
}
};

Expand Down

0 comments on commit 031195e

Please sign in to comment.