This creates a special kind of hell for implementers, especially JS, where not all binary can go through the binary string js unescape/charCodeAt safely, :crying_cat_face: Original spec was aiming to mitigate it by using plain text DAG-JSON OR multibase-encoded DAG-CBOR, as we know JS libraries for these do the right thing and no data corruption can occur.
Solution
Follow the spec, switch to percent-encoded DAG-JSON, but make it backward-compatible with format sent by Kubo 0.16:
If DAG-JSON fails to parse, a fallback to current (invalid) percent-encoded-CBOR-as-string parser should occur.
Problem
The specification we've cleaned up in https://github.com/ipfs/specs/pull/326 states that the value from
?q=value
is percent-encoded DAG-JSON.Turns out the edelweiss uses percent-encoded CBOR.
Example:
pd8 "github.com/ipld/go-ipld-prime/codec/dagcbor"
(and not dag-json) is used in places like https://github.com/ipfs/go-delegated-routing/blob/2646f6227c9411fc8825d9fed51a05cf2b740cab/gen/proto/proto_edelweiss.go#L1873-L1876This creates a special kind of hell for implementers, especially JS, where not all binary can go through the binary string js
unescape
/charCodeAt
safely, :crying_cat_face: Original spec was aiming to mitigate it by using plain text DAG-JSON OR multibase-encoded DAG-CBOR, as we know JS libraries for these do the right thing and no data corruption can occur.Solution
Follow the spec, switch to percent-encoded DAG-JSON, but make it backward-compatible with format sent by Kubo 0.16: If DAG-JSON fails to parse, a fallback to current (invalid) percent-encoded-CBOR-as-string parser should occur.
Test sample
Kubo 0.16 sends: