diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2024-08-02 04:50:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-08-02 04:50:25 +0000 |
commit | 3bb8c627aecc4abd89e7863cc11a7aef1ee74ed7 (patch) | |
tree | a5fad4b24d3ab19297db6eeff60cc36df9dc1600 /src/libexpr | |
parent | 8b69d1336804b08d01b6ec2a49709062b6c96d2b (diff) | |
parent | 87fd1f024c7c979e5d96c41af4ef7e8bdb5792e1 (diff) |
Merge "Reapply "libfetchers: make attribute / URL query handling consistent"" into main
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index a95df04ba..3be4ea550 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -169,14 +169,13 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( if (subdir != "") { if (parsedURL.query.count("dir")) throw Error("flake URL '%s' has an inconsistent 'dir' parameter", url); - parsedURL.query.insert_or_assign("dir", subdir); } if (pathExists(flakeRoot + "/.git/shallow")) parsedURL.query.insert_or_assign("shallow", "1"); return std::make_pair( - FlakeRef(Input::fromURL(parsedURL, isFlake), getOr(parsedURL.query, "dir", "")), + FlakeRef(Input::fromURL(parsedURL, isFlake), subdir), fragment); } @@ -204,7 +203,13 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( std::string fragment; std::swap(fragment, parsedURL.fragment); - auto input = Input::fromURL(parsedURL, isFlake); + // This has a special meaning for flakes and must not be passed to libfetchers. + // Of course this means that libfetchers cannot have fetchers + // expecting an argument `dir` 🫠+ ParsedURL urlForFetchers(parsedURL); + urlForFetchers.query.erase("dir"); + + auto input = Input::fromURL(urlForFetchers, isFlake); input.parent = baseDir; return std::make_pair( |