Take the query into account for plain path flakerefs

The query parameters for path flakerefs (`/foo/bar?query=blah` or
`.?foo=bar`) was ignored when the path wasn't a git repo.
Fix that
This commit is contained in:
Théophane Hufschmitt 2024-03-01 15:31:04 +01:00
parent f97d6a3178
commit fbf3f9398a

View File

@ -171,11 +171,16 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
path = canonPath(path + "/" + getOr(query, "dir", ""));
}
fetchers::Attrs attrs;
attrs.insert_or_assign("type", "path");
attrs.insert_or_assign("path", path);
auto parsedURL = ParsedURL{
.url = url,
.base = url,
.scheme = "path",
.authority = "",
.path = path,
.query = query,
};
return std::make_pair(FlakeRef(fetchers::Input::fromAttrs(std::move(attrs)), ""), fragment);
return std::make_pair(FlakeRef(fetchers::Input::fromURL(parsedURL), getOr(parsedURL.query, "dir", "")), fragment);
};