-
Notifications
You must be signed in to change notification settings - Fork 230
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
Fixed chunker chunk length calculation #680
Conversation
Thank you for this PR. We just need to test it out and make sure the unit tests for the chunker is still passing and then we can get this merged in. |
Unit tests are failing on this change, the chunk length returned is always 1 which cannot be correct. |
packages/ssr/src/utils/chunker.ts
Outdated
@@ -4,7 +4,7 @@ interface Chunk { | |||
} | |||
|
|||
function createChunkRegExp(chunkSize: number) { | |||
return new RegExp('.{1,' + chunkSize + '}', 'g'); | |||
return new RegExp(`(.{1,${chunkSize}})(?=%[0-9A-Fa-f]{2}|$)`, 'g'); |
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.
Why this change to the Regex?
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.
Yep, it was a mistake
Changing it back
@silentworks Sorry that haven't checked the tests in the first commit. |
…string for cookie chunker
@silentworks |
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.
You've made too many logic change in this code, please revert the logic to what it was before as your changes are complicating the code.
@silentworks okay I revert all logic of chunker and leave a test that is not passing. |
So possible solutions:
|
hi @dvvolynkin, thanks for working with @silentworks to hash out the possible solutions we can take to chunk the cookies correctly. just an update, we've decided to go with this approach: #726 so i'll be closing this PR |
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Cookie is too large
Value not encoded before splitting.
Sometimes, this causes too big chunks because the encoded cookie value length is longer than not encoded.
What is the new behavior?
Added splitting by encoded value