@cryptotaxi247 / kubo / commits / 773c24623

fix: ensure hasher is registered when using a hashing function

Fixes #9297

Jorropo committed Sep 26, 2022 at 06:55 UTC 773c246232c1f3d7fc67d7ddf5b1cb172ece8fa1
2 files changed +7
core/commands/add.go
+3
@@ -210,6 +210,9 @@ See 'dag export' and 'dag import' for more information.
210 if !ok {
211 return fmt.Errorf("unrecognized hash function: %q", strings.ToLower(hashFunStr))
212 }
213 + if _, err := mh.GetHasher(hashFunCode); err != nil {
214 + return err
215 + }
216
217 enc, err := cmdenv.GetCidEncoder(req)
218 if err != nil {
test/sharness/t0042-add-skip.sh
+4
@@ -93,6 +93,10 @@ EOF
93 test_cmp expected actual
94 '
95
96 + test_expect_failure "'ipfs add' with an unregistered hash and wrapped leaves fails without crashing" '
97 + ipfs add --hash poseidon-bls12_381-a2-fc1 --raw-leaves=false -r mountdir/planets
98 + '
99 +
100 }
101
102 # should work offline