mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Always use base-16 for hashed mirror lookups
In particular, don't use base-64, which we don't support. (We do have base-32 redirects for hysterical reasons.) Also, add a test for the hashed mirror feature.
This commit is contained in:
parent
49304bae81
commit
bf6792c0df
2 changed files with 15 additions and 1 deletions
|
@ -42,7 +42,8 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
|||
for (auto hashedMirror : settings.hashedMirrors.get())
|
||||
try {
|
||||
if (!hasSuffix(hashedMirror, "/")) hashedMirror += '/';
|
||||
data = fetch(hashedMirror + getAttr("outputHashAlgo") + "/" + getAttr("outputHash"));
|
||||
auto ht = parseHashType(getAttr("outputHashAlgo"));
|
||||
data = fetch(hashedMirror + printHashType(ht) + "/" + Hash(getAttr("outputHash"), ht).to_string(Base16, false));
|
||||
break;
|
||||
} catch (Error & e) {
|
||||
debug(e.what());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue