Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 1164748

Browse files
committed
fixup! fix: improved error message on broken CIDv0
1 parent 50890a1 commit 1164748

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func SplitAbsPath(fpath Path) (cid.Cid, []string, error) {
184184
func decodeCid(cstr string) (cid.Cid, error) {
185185
c, err := cid.Decode(cstr)
186186
if err != nil && len(cstr) == 46 && cstr[:2] == "qm" { // https://github.com/ipfs/go-ipfs/issues/7792
187-
return cid.Cid{}, 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)
187+
return cid.Cid{}, fmt.Errorf("%v: This looks like a CIDv0 that has been lowercased; consider converting to a case-agnostic CIDv1, such as base32", err)
188188
}
189189
return c, err
190190
}

path_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestV0ErrorDueToLowercase(t *testing.T) {
109109
if err == nil {
110110
t.Fatal("should have failed to decode")
111111
}
112-
if !strings.HasSuffix(err.Error(), "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.") {
112+
if !strings.HasSuffix(err.Error(), "This looks like a CIDv0 that has been lowercased; consider converting to a case-agnostic CIDv1, such as base32") {
113113
t.Fatal("should have meaningful info about case-insensitive fix")
114114
}
115115
}

0 commit comments

Comments
 (0)