aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanila Fedorin <danila.fedorin@gmail.com>2021-01-05 02:06:25 +0000
committerDanila Fedorin <danila.fedorin@gmail.com>2021-01-05 02:06:25 +0000
commit988dd0a65f562741708f6a7a7a44e333d6a5b205 (patch)
treebe4541d80f928651f0f8bbcf8ba3324ad07cbd28
parent8a2ce0f455da32bc20978e68c0aad9efb4560abc (diff)
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.
-rw-r--r--src/libfetchers/attrs.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libfetchers/attrs.cc b/src/libfetchers/attrs.cc
index 17fc4041f..a565d19d4 100644
--- a/src/libfetchers/attrs.cc
+++ b/src/libfetchers/attrs.cc
@@ -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");
}