diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 16:02:54 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 16:33:19 +0100 |
commit | f83acbbfe389c356ce95f61c48d193961717c480 (patch) | |
tree | 3feaa95246bf8018bff319341648bb8db837e95d /src/libexpr/flake | |
parent | 86748d357168ab37a4412d03c1f9ee99951843f5 (diff) |
Don't store fragment in FlakeRef
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index 5fc462246..a34d766d7 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -90,12 +90,11 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( .scheme = "flake", .authority = "", .path = match[1], - .fragment = percentDecode(std::string(match[6])) }; return std::make_pair( FlakeRef(inputFromURL(parsedURL), ""), - parsedURL.fragment); + percentDecode(std::string(match[6]))); } /* Check if 'url' is a path (either absolute or relative to @@ -131,9 +130,10 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( .authority = "", .path = flakeRoot, .query = decodeQuery(match[2]), - .fragment = percentDecode(std::string(match[3])) }; + auto fragment = percentDecode(std::string(match[3])); + if (subdir != "") { if (parsedURL.query.count("subdir")) throw Error("flake URL '%s' has an inconsistent 'subdir' parameter", url); @@ -142,14 +142,16 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( return std::make_pair( FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")), - parsedURL.fragment); + fragment); } else { auto parsedURL = parseURL(url); + std::string fragment; + std::swap(fragment, parsedURL.fragment); return std::make_pair( FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")), - parsedURL.fragment); + fragment); } } |