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")) {
|
||||
auto hash = s->empty() ? Hash(htSHA256) : Hash::parseSRI(*s);
|
||||
if (hash.type != htSHA256)
|
||||
throw UsageError("narHash must be specified with SRI notation");
|
||||
return newHashAllowEmpty(*s, htSHA256);
|
||||
throw UsageError("narHash must use SHA-256");
|
||||
return hash;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue