Closed lekoala closed 4 months ago
Hiya, First off, thank you for this contribution.
We added a new pull request template to this repository yesterday - but it looks like your PR description isn't using it. Did the template show up when you created this pull request?
hi @GuySartorelli , see here https://github.com/silverstripe/silverstripe-admin/pull/1640#issuecomment-1866899691 same explanation :)
I've added the template back in - please add any manual testing steps, or if there aren't any that are specific to this PR, please point back at the reproduction steps in the issue.
Please also tick all of the boxes that you have done, and do whatever is still not done based on the checklist.
Please also add some extra information to the description about whether this same encoding is done everywhere else toasts are sent, or if not, why this is being done in these specific places.
done unit test not necessary, but maybe some e2e testing that can actually capture the toast message. that seems like a painful things to do in behat so i won't dive into that :-) i didn't read the guidelines but i'm pretty sure it's ok :-)
This looks generally okay. Can you please update the commit message to include FIX
at the start (see commit message guidelines)?
Also, just for my own understanding, why do we need to encode the value at all, if we're decoding it in JS? Do header values not handle utf8 characters well?
@GuySartorelli basically only ascii characters are supported by the specs in http headers. There is no guarantee that utf8 encoding will be respected in http headers (it's up to the browser). Therefore, you need to encode the headers. For some characters, it's not required, but for single quote for example, url encoding is needed. Or even more extreme cases like emojis.
I took the initiative to align this PR with the behavior in CMSMain
This way, everthing works without any change on the js side of things
Description
Encodes toast messages, which will be decoded again on the other end
Things still need to be decoded properly though, but that's the first step. Another PR is coming up for the js side of things.
Outside the scope of this pr: it would probably make a lot of sense to standardize these calls instead of having the burden on the developer to remember to actually encode this stuff. rawurlencode is used everywhere anywhay so that's probably worth it!
Manual testing steps
Issues
Pull request checklist