Skip to content

Fix empty buffer case for Browser base64 encoding#131

Merged
darrachequesne merged 1 commit into
socketio:mainfrom
maunvz:empty-buffer-fix
Jan 6, 2023
Merged

Fix empty buffer case for Browser base64 encoding#131
darrachequesne merged 1 commit into
socketio:mainfrom
maunvz:empty-buffer-fix

Conversation

@maunvz

@maunvz maunvz commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

Currently, passing an empty blob to encodeBlobAsBase64 results in "bundefined" getting passed
to the callback, because fileReader.result returns "data:" instead of the expected format:
"data:application/octet-stream;base64,"

This fix turns an "undefined" into "" so the callback is sent "b" (with is correctly decodes to [] by
the receivers) instead of "bundefined", which decodes to [0xba, 0x77, 0x5e, 0x7e, 0x29, 0xde]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants