Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libexpr/primops/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static void prim_wasm(EvalState & state, const PosIdx pos, Value ** args, Value
}

static RegisterPrimOp primop_wasm(
{.name = "wasm",
{.name = "__wasm",
.args = {"wasm", "entry", "arg"},
.doc = R"(
Call a Wasm function with the specified argument.
Expand Down Expand Up @@ -648,7 +648,7 @@ static void prim_wasi(EvalState & state, const PosIdx pos, Value ** args, Value
}

static RegisterPrimOp primop_wasi(
{.name = "wasi",
{.name = "__wasi",
.args = {"wasi", "arg"},
.doc = R"(
Call a WASI function with the specified argument.
Expand Down
5 changes: 1 addition & 4 deletions src/libfetchers/include/nix/fetchers/provenance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ struct FetchurlProvenance : Provenance
{
std::string url;

FetchurlProvenance(const std::string & url)
: url(url)
{
}
FetchurlProvenance(std::string url, bool sanitize = true);

nlohmann::json to_json() const override;
};
Expand Down
13 changes: 12 additions & 1 deletion src/libfetchers/provenance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ Provenance::Register registerTreeProvenance("tree", [](nlohmann::json json) {
return make_ref<TreeProvenance>(make_ref<nlohmann::json>(attrsJson));
});

FetchurlProvenance::FetchurlProvenance(std::string _url, bool sanitize)
: url(std::move(_url))
{
if (sanitize) {
try {
url = parseURL(url, true).renderSanitized();
} catch (BadURL &) {
}
}
}

nlohmann::json FetchurlProvenance::to_json() const
{
return nlohmann::json{
Expand All @@ -41,7 +52,7 @@ nlohmann::json FetchurlProvenance::to_json() const

Provenance::Register registerFetchurlProvenance("fetchurl", [](nlohmann::json json) {
auto & obj = getObject(json);
return make_ref<FetchurlProvenance>(getString(valueAt(obj, "url")));
return make_ref<FetchurlProvenance>(getString(valueAt(obj, "url")), false);
});

} // namespace nix
2 changes: 1 addition & 1 deletion src/libfetchers/tarball.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ DownloadFileResult downloadFile(
hashString(HashAlgorithm::SHA256, sink.s));
info.narSize = sink.s.size();
if (experimentalFeatureSettings.isEnabled(Xp::Provenance))
info.provenance = std::make_shared<FetchurlProvenance>(request.uri.parsed().renderSanitized());
info.provenance = std::make_shared<FetchurlProvenance>(request.uri.to_string());
auto source = StringSource{sink.s};
store.addToStore(info, source, NoRepair, NoCheckSigs);
storePath = std::move(info.path);
Expand Down
2 changes: 1 addition & 1 deletion src/nix/prefetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ std::tuple<StorePath, Hash> prefetchFile(
name,
{make_ref<OverrideProvenanceSourceAccessor>(
makeFSSourceAccessor(tmpFile),
unpack ? nullptr : std::make_shared<FetchurlProvenance>(url.parsed().renderSanitized()))},
unpack ? nullptr : std::make_shared<FetchurlProvenance>(url.to_string()))},
method,
hashAlgo,
{},
Expand Down