Skip to content

Commit

Permalink
A backward-compatibility fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning committed Mar 1, 2017
1 parent 19a2382 commit 957aa93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions entwine/types/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,24 @@ Metadata::Metadata(
Metadata::Metadata(const arbiter::Endpoint& ep, const std::size_t* subsetId)
: Metadata(([&ep, subsetId]()
{
// Prior to 1.0, there were some keys nested in the top-level "format"
// key. Now those nested keys are themselves at the top level.
//
// Note that we are not fully-constructed yet so we can't call our
// Metadata::postfix() yet, as we would like to.
Json::Value json(parse(ep.get("entwine" + Subset::postfix(subsetId))));

// Pre-1.0: nested keys have since been flattened.
if (json.isMember("format"))
{
for (const auto& k : json["format"].getMemberNames())
{
json[k] = json["format"][k];
}
}

// Pre-1.0: casing was inconsistent with other keys.
if (json.isMember("compress-hierarchy"))
{
json["compressHierarchy"] = json["compress-hierarchy"];
}
return json;
})())
{
Expand Down

0 comments on commit 957aa93

Please sign in to comment.