Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

pubsub.publish mangles binary buffers #569

Closed
vith opened this issue Jun 20, 2017 · 1 comment
Closed

pubsub.publish mangles binary buffers #569

vith opened this issue Jun 20, 2017 · 1 comment

Comments

@vith
Copy link
Contributor

vith commented Jun 20, 2017

I was trying to send a CBOR serialized object through the pubsub API and found that the bytes were not being round tripped intact. This is because the Buffer passes through a querystring on its way to the go-ipfs instance, and the qs library being used does not handle a binary buffer safely in this function: https://github.com/ljharb/qs/blob/v6.4.0/lib/utils.js#L88

I have a patch for js-ipfs-api that uses qs.stringify's encoder option to override the encoding of Buffer objects, escaping every byte that isn't an rfc3986 unreserved character without further mutations. I'll submit it as a PR shortly in case it's the desired solution. I'm not familiar enough with this library/spec to say, but maybe the buffer should just be sent in the request body instead of in a query string parameter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant