From cc1432461676d45d8ba140057e8d4eeaa8045432 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 10 Aug 2023 12:45:33 +0200 Subject: Allow oplog file mapping where ServerPath is missing if a attachment hash is specified (#352) --- CHANGELOG.md | 3 +++ src/zenserver/projectstore/projectstore.cpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63fd67501..59c4d067c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## +- Bugfix: Allow oplog file mapping where ServerPath is missing if a attachment hash is specified + +## 0.2.15 - Feature: Add `--assume-http2` option to cloud style import/export command to use a HTTP/2 endpoint without without HTTP/1.1 upgrade - Bugfix: Make sure out of memory condition does not terminate http-asio service thread. UE-191531 - Bugfix: `oplog-import` with `--file` source now sends the oplog folder correctly to zenserver 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); } -- cgit v1.2.3