aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-03 15:27:26 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-03 15:27:26 +0100
commita2628b43bbfe4368a3b5963e8b80eb6f463d94c3 (patch)
treec72b9fa978113ea550e20ae0b00e3829f4bdf25a /src/libexpr
parentd070e1c5321b43496f1113198e62b2b647433459 (diff)
Fix URL parser
Fixes #3062.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/flake/flakeref.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index a34d766d7..c46661df8 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -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);