aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/fetchTree.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/primops/fetchTree.cc')
-rw-r--r--src/libexpr/primops/fetchTree.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc
index 745f65adf..1464aa8b4 100644
--- a/src/libexpr/primops/fetchTree.cc
+++ b/src/libexpr/primops/fetchTree.cc
@@ -102,14 +102,9 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
string n(attr.name);
if (n == "url")
url = state.forceStringNoCtx(*attr.value, *attr.pos);
- else if (n == "sha256") {
- auto hashStr = state.forceStringNoCtx(*attr.value, *attr.pos);
- if (hashStr == "") {
- expectedHash = Hash(htSHA256);
- printError("warning: found empty hash, assuming you wanted '%s'", expectedHash->to_string());
- } else
- expectedHash = Hash(hashStr, htSHA256);
- } else if (n == "name")
+ else if (n == "sha256")
+ expectedHash = newHashAllowEmpty(state.forceStringNoCtx(*attr.value, *attr.pos), htSHA256);
+ else if (n == "name")
name = state.forceStringNoCtx(*attr.value, *attr.pos);
else
throw EvalError("unsupported argument '%s' to '%s', at %s",