diff options
author | Kevin Quick <kquick@galois.com> | 2020-09-25 09:36:18 -0700 |
---|---|---|
committer | Kevin Quick <kquick@galois.com> | 2020-09-25 09:36:18 -0700 |
commit | cb186f1e7536c9448455bfbf8dec16ad6600e88e (patch) | |
tree | f61ac7ec5194eb370c875fb89d76601b02611700 /src/libexpr/flake/flakeref.cc | |
parent | 7d815824885305eaed83f025826f8a8c3330693d (diff) |
Use "?dir=..." portion of "registry add" local path specification.
The registry targets generally follow a URL formatting schema with
support for a query parameter of "?dir=subpath" to specify a sub-path
location below the URL root.
Alternatively, an absolute path can be specified. This specification
mode accepts the query parameter but ignores/drops it. It would
probably be better to either (a) disallow the query parameter for the
path form, or (b) recognize the query parameter and add to the path.
This patch implements (b) for consistency, and to make it easier for
tooling that might switch between a remote git reference and a local
path reference.
See also issue #4050.
Diffstat (limited to 'src/libexpr/flake/flakeref.cc')
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index d5c2ffe66..762e27e1f 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -157,7 +157,8 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( } else { if (!hasPrefix(path, "/")) throw BadURL("flake reference '%s' is not an absolute path", url); - path = canonPath(path); + auto query = decodeQuery(match[2]); + path = canonPath(path + "/" + get(query, "dir").value_or("")); } fetchers::Attrs attrs; |