cid format ignores the explicitly passed multibase prefix (-b) when CIDv0 is used
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -b z --mc dag-pb -v 0
QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -b z --mc dag-pb
QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ
Fix
We already return an explicit error when both custom --mc and -v 0 are passed:
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -b z --mc raw -v 0
Error: cannot convert to CIDv0 with any codec other than dag-pb
In the same spirit, Kubo should:
(1) error when -v 0 is present and a custom -b is passed:
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -b z -v 0
Error: cannot convert to CIDv0 with any multibase other than the implicit base58btc
(2) upgrade CID to v1 when passing a custom -b and no -v is specified,
just like we do with --mc other than dag-pb:
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ --mc raw
zb2rhY9jZ8RCMjxqDzk1eVDkNendBibd42BbRMP5UB4Ei7de2
$ ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -b z
bafybeiawm5lgdgchgrhep4kxo2g4tptewtpcnfzusyfcopytpuj2fnzf2m
Version
Description
UX Bug found while investigating https://github.com/multiformats/js-multiformats/issues/240:
cid format
ignores the explicitly passed multibase prefix (-b
) when CIDv0 is usedFix
We already return an explicit error when both custom
--mc
and-v 0
are passed:In the same spirit, Kubo should:
(1) error when
-v 0
is present and a custom-b
is passed:(2) upgrade CID to v1 when passing a custom
-b
and no-v
is specified, just like we do with--mc
other thandag-pb
: