Skip to content

Commit 6fca8eb

Browse files
committed
fix: add default for cid base and fix cid version override
1 parent fc62dd4 commit 6fca8eb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/cli/commands/add.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ module.exports = {
8585
'cid-base': {
8686
describe: 'Number base to display CIDs in.',
8787
type: 'string',
88-
choices: multibase.names
88+
choices: multibase.names,
89+
default: 'base58btc'
8990
},
9091
hash: {
9192
type: 'string',

src/core/components/add/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = ({ ipld, gcLock, preload, pin, options: constructorOptions }) =
1818
}
1919

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

0 commit comments

Comments
 (0)