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:
Danila Fedorin 2021-01-05 02:06:25 +00:00
parent 8a2ce0f455
commit 988dd0a65f

View file

@ -15,7 +15,7 @@ Attrs jsonToAttrs(const nlohmann::json & json)
else if (i.value().is_string())
attrs.emplace(i.key(), i.value().get<std::string>());
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
throw Error("unsupported input attribute type in lock file");
}