-
Notifications
You must be signed in to change notification settings - Fork 1.2k
PubSub splits binary message on 0x0a byte (EOL character) #3567
Comments
I've opened an issue against go-IPFS for this. This essentially needs go-IPFS to allow the client to send data in a specific encoding which will prevent rogue characters doing this sort of thing. |
Thank you @achingbrain - please let me know if there is anything I can do to help. In the meantime, if anyone needs a workaround... Publish the bytes as a base64 encoded string: ipfs.pubsub.publish('example', buffer.toString('base64')); Double decode the incoming message: ipfs.pubsub.subscribe('example', (message) => {
const buffer = Buffer.from(Buffer.from(message.data).toString(), 'base64');
}); |
Some progress on this: ipfs/kubo#8183 |
js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide. Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see #4336). @achingbrain to answer whether this should impact Helia moving forward. |
Please upgrade to https://github.com/ipfs/js-kubo-rpc-client - it's a drop-in replacement for Please open an issue on the |
Darwin johnwehr.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64 x86_64
ipfs-http-client/src/lib/multipart-request.node.js
Severity:
High
Description:
PubSub messages are split when the payload contains a
0x0a
character.Steps to reproduce the error:
0
0x0a
byte into the buffer at any positionpubsub.publish(...)
the bufferpubsub.subscribe(...)
handlers receive two messagesThe text was updated successfully, but these errors were encountered: