Skip to content

Commit 52b2909

Browse files
authored
Merge pull request #14491 from NixOS/fix-14311
Don't crash on flakerefs containing newlines
2 parents 34c77ff + c131701 commit 52b2909

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libflake/flakeref.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
109109

110110
std::smatch match;
111111
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
112-
assert(succeeds);
112+
if (!succeeds)
113+
throw Error("invalid flakeref '%s'", url);
113114
auto path = match[1].str();
114115
auto query = decodeQuery(match[3].str(), /*lenient=*/true);
115116
auto fragment = percentDecode(match[5].str());

0 commit comments

Comments
 (0)