mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Implement parseURLRelative, use in HttpBinaryCacheStore
This allows us to replace some very hacky and not correct string concatentation in `HttpBinaryCacheStore`. It will especially be useful with #13752, when today's hacks started to cause problems in practice, not just theory. Also make `fixGitURL` returned a `ParsedURL`.
This commit is contained in:
parent
231f3af535
commit
e82210b3b2
7 changed files with 278 additions and 30 deletions
|
|
@ -113,7 +113,7 @@ static void fetchTree(
|
|||
auto s = state.coerceToString(attr.pos, *attr.value, context, "", false, false).toOwned();
|
||||
attrs.emplace(
|
||||
state.symbols[attr.name],
|
||||
params.isFetchGit && state.symbols[attr.name] == "url" ? fixGitURL(s) : s);
|
||||
params.isFetchGit && state.symbols[attr.name] == "url" ? fixGitURL(s).to_string() : s);
|
||||
} else if (attr.value->type() == nBool)
|
||||
attrs.emplace(state.symbols[attr.name], Explicit<bool>{attr.value->boolean()});
|
||||
else if (attr.value->type() == nInt) {
|
||||
|
|
@ -175,7 +175,7 @@ static void fetchTree(
|
|||
if (params.isFetchGit) {
|
||||
fetchers::Attrs attrs;
|
||||
attrs.emplace("type", "git");
|
||||
attrs.emplace("url", fixGitURL(url));
|
||||
attrs.emplace("url", fixGitURL(url).to_string());
|
||||
if (!attrs.contains("exportIgnore")
|
||||
&& (!attrs.contains("submodules") || !*fetchers::maybeGetBoolAttr(attrs, "submodules"))) {
|
||||
attrs.emplace("exportIgnore", Explicit<bool>{true});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue