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

Merge pull request #14491 from NixOS/fix-14311

Don't crash on flakerefs containing newlines
This commit is contained in:
Eelco Dolstra 2025-11-06 18:29:44 +00:00 committed by GitHub
commit 52b2909fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,7 +109,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());