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

Commit

Permalink
fix: add default for cid base and fix cid version override
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Mar 27, 2020
1 parent 2248270 commit d951993
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ipfs/src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ module.exports = {
'cid-base': {
describe: 'Number base to display CIDs in.',
type: 'string',
choices: multibase.names
choices: multibase.names,
default: 'base58btc'
},
hash: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs/src/core/components/add/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = ({ ipld, gcLock, preload, pin, options: constructorOptions }) =
}

// CID v0 is for multihashes encoded with sha2-256
if (opts.hashAlg && opts.cidVersion !== 1) {
if (opts.hashAlg && opts.hashAlg !== 'sha2-256' && opts.cidVersion !== 1) {
opts.cidVersion = 1
}

Expand Down

0 comments on commit d951993

Please sign in to comment.