aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-08-10 12:45:33 +0200
committerGitHub <[email protected]>2023-08-10 12:45:33 +0200
commitcc1432461676d45d8ba140057e8d4eeaa8045432 (patch)
treedceaacd17cb3c824655c65dae1cb191b45aec703
parent0.2.15 (diff)
downloadzen-cc1432461676d45d8ba140057e8d4eeaa8045432.tar.xz
zen-cc1432461676d45d8ba140057e8d4eeaa8045432.zip
Allow oplog file mapping where ServerPath is missing if a attachment hash is specified (#352)
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/zenserver/projectstore/projectstore.cpp13
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);
}