Closed ickby closed 3 years ago
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:
Finally, remember to use https://discuss.ipfs.io if you just need general support.
"Undef" is really just the "nil" type for CIDs, and it's not a valid CID. We refuse to unmarshal zero-length json/text CIDs as well.
Unfortunately, with "UnmarshalBinary", there is no real "null".
ok, if it's a deliberate decision I work around it.
Cid implements multiple go encoding interfaces, including golangs "encoding.BinaryUnmarshaler". For this it uses the function "CidFromBytes" via "Cast". However, this function cannot handle empty bytes. As the default value of a undefined cid, CidUndef, is represented via empty string/byte sequence, a problem arises. One can marshal all cids, except cid Undef, which results in an error. Imho this should be possible, as CidUndef is a valid part of the implementation.
To reproduce the problem: `
` This results in "decode error: varints malformed, could not reach the end"