Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: differentiate between invalid multihash and invalid CID
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw committed Aug 15, 2018
1 parent 27598a6 commit ec24044
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/components/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ module.exports = function object (self) {

try {
mh = normalizeMultihash(multihash, options.enc)
} catch (err) {
return setImmediate(() => callback(errCode(err, 'ERR_INVALID_MULTIHASH')))
}

try {
cid = new CID(mh)
} catch (err) {
return setImmediate(() => callback(errCode(err, 'ERR_INVALID_CID')))
Expand Down

0 comments on commit ec24044

Please sign in to comment.