-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix HTTP client reading non-ascii journal content #47
Conversation
Switching more tests to snapshots to test a wider range of things all at once Getting some tests updated to handle the new control plane
The grpc gateway returns journal content as a base64-encoded string. Previously, we had been using `atob` to decode this, but that function does not work if the decoded content contains any byte values larger than 0x7f, because of course we can't have nice things in JS. So this adds one of those looks-insane-but-actually-works workarounds to make base64 decoding work properly with arbitrary utf-8 data.
@@ -50,7 +50,17 @@ export function decodeContent() { | |||
transform(value, controller) { | |||
// Base64 decode the `content` field and send it as a chunk. | |||
if (value.content?.length) { | |||
controller.enqueue(atob(value.content)); | |||
// The `atob` function does not work properly if the decoded content contains any byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we are not running in node
but in the UI we have stopped using atob
and btoa
and replaced with 'Bufferand
.toString('base64')`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind trying this out on my local and running the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind - as that will be a pain polyfilling Node stuff.
Issue
#46
Fixes
Updated tests to work with recent control plane changes
...tbd
Tests
Added content read tests that include Arabic in the messages. These tests are failing until we implement a fix. Also, noticed that in the printing of the snapshot the string that contains Arabic seems to get flipped. Not sure if this is Deno being clever to render RTL.
Notes
ShardClient.list task selector test
is failing locally when checking forPRIMARY
as the status. It is failing due to this error: