aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorDelan Azabani <delan@azabani.com>2024-07-02 07:20:01 +0000
committerGerrit Code Review <gerrit@localhost>2024-07-02 07:20:01 +0000
commit865a3732faca16a79bf24982011adf100de04463 (patch)
tree8021062dbf69743071847d4f3337f4be6ee984b1 /src/libexpr
parentd3286d0990da111c536c2f879d8f9cbbd650ebae (diff)
parentb2944d93a6d95810f0aef09e9ac44b95e2712554 (diff)
Merge "Reject fully-qualified URLs in 'from' argument of `nix registry add`" into main
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/flake/flakeref.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index 1c90bfc43..a95df04ba 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -85,8 +85,8 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
+ "(?:#(" + queryRegex + "))?",
std::regex::ECMAScript);
- static std::regex flakeRegex(
- "((" + flakeIdRegexS + ")(?:/(?:" + refAndOrRevRegex + "))?)"
+ static std::regex flakeShorthandRegex(
+ flakeShorthandRegexS
+ "(?:#(" + queryRegex + "))?",
std::regex::ECMAScript);
@@ -95,7 +95,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
/* Check if 'url' is a flake ID. This is an abbreviated syntax for
'flake:<flake-id>?ref=<ref>&rev=<rev>'. */
- if (std::regex_match(url, match, flakeRegex)) {
+ if (std::regex_match(url, match, flakeShorthandRegex)) {
auto parsedURL = ParsedURL{
.url = url,
.base = "flake:" + match.str(1),