missing unmarshalling of content bytes before encoding and generation… #86

Closed
ABastionOfSanity wants to merge 4 commits from fix_cid_generation into main
Showing only changes of commit 44ab3f6fc0 - Show all commits

View File

@ -72,7 +72,10 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
//see: https://pkg.go.dev/github.com/ipld/go-ipld-prime //see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
np := basicnode.Prototype.Any // Pick a stle for the in-memory data. np := basicnode.Prototype.Any // Pick a stle for the in-memory data.
nb := np.NewBuilder() // Create a builder. nb := np.NewBuilder() // Create a builder.
dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in! err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in!
if err != nil {
return "", err
}
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!) n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!)
lsys := cidlink.DefaultLinkSystem() lsys := cidlink.DefaultLinkSystem()