diff options
| author | Dan Engelbrecht <[email protected]> | 2023-08-10 12:45:33 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-10 12:45:33 +0200 |
| commit | cc1432461676d45d8ba140057e8d4eeaa8045432 (patch) | |
| tree | dceaacd17cb3c824655c65dae1cb191b45aec703 /src | |
| parent | 0.2.15 (diff) | |
| download | zen-cc1432461676d45d8ba140057e8d4eeaa8045432.tar.xz zen-cc1432461676d45d8ba140057e8d4eeaa8045432.zip | |
Allow oplog file mapping where ServerPath is missing if a attachment hash is specified (#352)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index e5088e11d..64f0244d5 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -850,14 +850,19 @@ ProjectStore::Oplog::GetMapping(CbObject Core) std::string_view ServerPath = FileObj["serverpath"sv].AsString(); std::string_view ClientPath = FileObj["clientpath"sv].AsString(); - if (ServerPath.empty() || ClientPath.empty()) + Oid Id = FileObj["id"sv].AsObjectId(); + IoHash Hash = FileObj["data"sv].AsBinaryAttachment(); + if (ServerPath.empty() && Hash == IoHash::Zero) { - ZEN_WARN("invalid file"); + ZEN_WARN("invalid file for entry '{}', missing both 'serverpath' and 'data' fields", Id); + continue; + } + if (ClientPath.empty()) + { + ZEN_WARN("invalid file for entry '{}', missing 'both 'clientpath'", Id); continue; } - Oid Id = FileObj["id"sv].AsObjectId(); - IoHash Hash = FileObj["data"sv].AsBinaryAttachment(); Result.Files.emplace_back(OplogEntryMapping::FileMapping{Id, Hash, std::string(ServerPath), std::string(ClientPath)}); ZEN_DEBUG("file {} -> {}, ServerPath: {}, ClientPath: {}", Id, Hash, ServerPath, ClientPath); } |