Forbid the name attribute for fetchTree

We need to support it for the “old” fetch* functions for backwards
compatibility, but we don’t need it for fetchTree (as it’s a new
function).
Given that changing the `name` messes-up the content hashing, we can
just forbid passing a custom `name` argument to it
This commit is contained in:
regnat
2021-07-08 13:53:52 +02:00
parent 2c8240677e
commit 7e5c79a2d2
2 changed files with 12 additions and 1 deletions
+7
View File
@@ -119,6 +119,13 @@ static void fetchTree(
.errPos = pos
});
if (auto nameIter = attrs.find("name"); nameIter != attrs.end())
throw Error({
.msg = hintfmt("attribute 'name' isnt supported in call to 'fetchTree'"),
.errPos = pos
});
input = fetchers::Input::fromAttrs(std::move(attrs));
} else {
auto url = fixURI(state.coerceToString(pos, *args[0], context, false, false), state);