Conversation
cb0a609 to
20232f8
Compare
| _, data, err := mbase.Decode(v) | ||
| if err != nil { | ||
| if len(v) == 46 && v[:2] == "qm" { // https://github.com/ipfs/go-ipfs/issues/7792 | ||
| return Undef, fmt.Errorf("%v: This looks like a CIDv0 that has been lowercased. Convert the CIDv0 to CIDv1 in case-insensitive base32 using 'ipfs cid base32 <Qm..>' and try again.", err) |
There was a problem hiding this comment.
Seems like an awfully low level to be handing out command specific advice, since this library has wide use, well beyond go-ipfs. This could arise out of use within Filecoin, or a CAR manipulation library, use-cases where ipfs isn't even a thing.
Is there a place above the stack from here, closer to the user, where this check could be inserted instead?
In lieu of that, maybe softening it to seem a little less prescriptive?
"%v: This may be a CIDv0 that has been lowercased and cannot be decoded. Base32 CIDv1 is recommended where case-insensitivity is required (e.g. with 'ipfs cid base32 <Qm..>')."
There was a problem hiding this comment.
I agree with Rod; the error message here should be reasonably generic, and IPFS could always do the extra check if go-cid returns an error.
jessicaschilling
left a comment
There was a problem hiding this comment.
I can't weigh in on how generic/specific we need to be, but either the original proposed text or the message in #116 (comment) read well to me.
|
This is probably best fixed in go-path. |
move lidel's fix from ipfs/go-cid#116
move lidel's fix from ipfs/go-cid#116
|
go-path is a much better idea, since it's already ipfs-specific. I've copied this fix, almost exactly as is (including original msg), to ipfs/go-path#33, would that be acceptable to all? |
move lidel's fix from ipfs/go-cid#116
|
I believe ipfs/go-path#33 is fine, this can be closed. |
move lidel's fix from ipfs/go-cid#116 This commit was moved from ipfs/go-path@5e8ad22
This aims to close DX/UX issue described in ipfs/kubo#7792
Before
invalid path "/ipfs/qmbwqxbekc3p8tqskc98xmwnzrzdtrlmimpl8wbutgsmnr/": invalid CID: selected encoding not supportedAfter
invalid path "/ipfs/qmbwqxbekc3p8tqskc98xmwnzrzdtrlmimpl8wbutgsmnr/": invalid CID: selected encoding not supported: This looks like a CIDv0 that has been lowercased. Convert the CIDv0 to CIDv1 in case-insensitive base32 using 'ipfs cid base32 <Qm..>' and try again.