1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

Don't crash on flakerefs containing newlines

Fixes #14311.

(cherry picked from commit c1317017e9)
This commit is contained in:
Eelco Dolstra 2025-11-06 13:06:08 +01:00 committed by github-actions[bot]
parent 5c9e22d75a
commit 47ba375285

View file

@ -80,7 +80,8 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
std::smatch match; std::smatch match;
auto succeeds = std::regex_match(url, match, pathFlakeRegex); auto succeeds = std::regex_match(url, match, pathFlakeRegex);
assert(succeeds); if (!succeeds)
throw Error("invalid flakeref '%s'", url);
auto path = match[1].str(); auto path = match[1].str();
auto query = decodeQuery(match[3].str(), /*lenient=*/true); auto query = decodeQuery(match[3].str(), /*lenient=*/true);
auto fragment = percentDecode(match[5].str()); auto fragment = percentDecode(match[5].str());