aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tarball.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 21:58:27 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 22:11:19 +0000
commitbbbf3602a323538b8da38f1a2c7ce136a20f74c6 (patch)
treee783d838d8a75d854e0b72eea03784c5909040bc /src/libfetchers/tarball.cc
parent406dbb7fce32f7d80b02f560d91c956698b58d6e (diff)
parent40526fbea56a8006eb7f1758d461a5acbe9a1694 (diff)
Merge branch 'enum-class' into no-hash-type-unknown
Diffstat (limited to 'src/libfetchers/tarball.cc')
-rw-r--r--src/libfetchers/tarball.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index 1030c191a..c82b6dd09 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -196,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;
}
@@ -207,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;
}
@@ -264,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, {});
return input;
}