aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tarball.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfetchers/tarball.cc')
-rw-r--r--src/libfetchers/tarball.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index 3e9004223..560ecbd7e 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -71,7 +71,8 @@ DownloadFileResult downloadFile(
info.narHash = hashString(HashType::SHA256, *sink.s);
info.narSize = sink.s->size();
info.ca = makeFixedOutputCA(FileIngestionMethod::Flat, hash);
- store->addToStore(info, sink.s, NoRepair, NoCheckSigs);
+ auto source = StringSource { *sink.s };
+ store->addToStore(info, source, NoRepair, NoCheckSigs);
storePath = std::move(info.path);
}
@@ -195,9 +196,9 @@ struct TarballInput : Input
// NAR hashes are preferred over file hashes since tar/zip files
// don't have a canonical representation.
if (narHash)
- url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI));
+ url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI, true));
else if (hash)
- url2.query.insert_or_assign("hash", hash->to_string(Base::SRI));
+ url2.query.insert_or_assign("hash", hash->to_string(Base::SRI, true));
return url2;
}
@@ -206,7 +207,7 @@ struct TarballInput : Input
Attrs attrs;
attrs.emplace("url", url.to_string());
if (hash)
- attrs.emplace("hash", hash->to_string(Base::SRI));
+ attrs.emplace("hash", hash->to_string(Base::SRI, true));
return attrs;
}
@@ -263,8 +264,7 @@ struct TarballInputScheme : InputScheme
auto input = std::make_unique<TarballInput>(parseURL(getStrAttr(attrs, "url")));
if (auto hash = maybeGetStrAttr(attrs, "hash"))
- // FIXME: require SRI hash.
- input->hash = Hash(*hash);
+ input->hash = newHashAllowEmpty(*hash, HashType::Unknown);
return input;
}