forked from lix-project/lix
Don't store fragment in FlakeRef
This commit is contained in:
parent
86748d3571
commit
f83acbbfe3
|
@ -90,12 +90,11 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
||||||
.scheme = "flake",
|
.scheme = "flake",
|
||||||
.authority = "",
|
.authority = "",
|
||||||
.path = match[1],
|
.path = match[1],
|
||||||
.fragment = percentDecode(std::string(match[6]))
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
FlakeRef(inputFromURL(parsedURL), ""),
|
FlakeRef(inputFromURL(parsedURL), ""),
|
||||||
parsedURL.fragment);
|
percentDecode(std::string(match[6])));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if 'url' is a path (either absolute or relative to
|
/* Check if 'url' is a path (either absolute or relative to
|
||||||
|
@ -131,9 +130,10 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
||||||
.authority = "",
|
.authority = "",
|
||||||
.path = flakeRoot,
|
.path = flakeRoot,
|
||||||
.query = decodeQuery(match[2]),
|
.query = decodeQuery(match[2]),
|
||||||
.fragment = percentDecode(std::string(match[3]))
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto fragment = percentDecode(std::string(match[3]));
|
||||||
|
|
||||||
if (subdir != "") {
|
if (subdir != "") {
|
||||||
if (parsedURL.query.count("subdir"))
|
if (parsedURL.query.count("subdir"))
|
||||||
throw Error("flake URL '%s' has an inconsistent 'subdir' parameter", url);
|
throw Error("flake URL '%s' has an inconsistent 'subdir' parameter", url);
|
||||||
|
@ -142,14 +142,16 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
||||||
|
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
|
FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
|
||||||
parsedURL.fragment);
|
fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
auto parsedURL = parseURL(url);
|
auto parsedURL = parseURL(url);
|
||||||
|
std::string fragment;
|
||||||
|
std::swap(fragment, parsedURL.fragment);
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
|
FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
|
||||||
parsedURL.fragment);
|
fragment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue