forked from lix-project/lix
Fix error message and avoid recalculation
This commit is contained in:
parent
bc165e28ae
commit
c4ada76e86
|
@ -203,8 +203,8 @@ std::optional<Hash> Input::getNarHash() const
|
||||||
if (auto s = maybeGetStrAttr(attrs, "narHash")) {
|
if (auto s = maybeGetStrAttr(attrs, "narHash")) {
|
||||||
auto hash = s->empty() ? Hash(htSHA256) : Hash::parseSRI(*s);
|
auto hash = s->empty() ? Hash(htSHA256) : Hash::parseSRI(*s);
|
||||||
if (hash.type != htSHA256)
|
if (hash.type != htSHA256)
|
||||||
throw UsageError("narHash must be specified with SRI notation");
|
throw UsageError("narHash must use SHA-256");
|
||||||
return newHashAllowEmpty(*s, htSHA256);
|
return hash;
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue