forked from lix-project/lix
Fix conversion from JSON to fetch attributes
It appears as through the fetch attribute, which is simply a variant with 3 elements, implicitly converts boolean arguments to integers. One must use Explicit<bool> to correctly populate it with a boolean. This was missing from the implementation, and resulted in clearly boolean JSON fields being treated as numbers.
This commit is contained in:
parent
8a2ce0f455
commit
988dd0a65f
|
@ -15,7 +15,7 @@ Attrs jsonToAttrs(const nlohmann::json & json)
|
||||||
else if (i.value().is_string())
|
else if (i.value().is_string())
|
||||||
attrs.emplace(i.key(), i.value().get<std::string>());
|
attrs.emplace(i.key(), i.value().get<std::string>());
|
||||||
else if (i.value().is_boolean())
|
else if (i.value().is_boolean())
|
||||||
attrs.emplace(i.key(), i.value().get<bool>());
|
attrs.emplace(i.key(), Explicit<bool> { i.value().get<bool>() });
|
||||||
else
|
else
|
||||||
throw Error("unsupported input attribute type in lock file");
|
throw Error("unsupported input attribute type in lock file");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue