1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Fix URL parser

Fixes #3062.
This commit is contained in:
Eelco Dolstra 2020-02-03 15:27:26 +01:00
parent d070e1c532
commit a2628b43bb
3 changed files with 25 additions and 21 deletions

View file

@ -67,8 +67,10 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
{
using namespace fetchers;
static std::string fnRegex = "[0-9a-zA-Z-._~!$&'\"()*+,;=]+";
static std::regex pathUrlRegex(
"(" + pathRegex + "/?)"
"(/?" + fnRegex + "(?:/" + fnRegex + ")*/?)"
+ "(?:\\?(" + queryRegex + "))?"
+ "(?:#(" + queryRegex + "))?",
std::regex::ECMAScript);