feat(workspace): support percent‐escaped Base64 with special characters in code= URL parameter #6023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Desciption
This change improves how the Workspace plugin decodes the code= fragment passed via the URL, allowing it to correctly handle any percent‐escaped Base64 payload—including strings containing non‐ASCII or URL-unsafe characters. Previously the code was decoded inline with decodeURIComponent + atob, which could break on certain edge cases.
Changes
decodePercentEscapedBase64
helper functionlibs/remix-ui/workspace/src/lib/actions/workspace.ts
to call decodePercentEscapedBase64(params.code) instead of inline atob(decodeURIComponent(params.code)Why
In OpenZeppelin's wizard we recently added support for unicode characters
And modified the encoding of the code parameter to be sent to remix to support special characters
How to test
http://localhost:8080/?#code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAovLyBDb21wYXRpYmxlIHdpdGggT3BlblplcHBlbGluIENvbnRyYWN0cyBeNS4wLjAKcHJhZ21hIHNvbGlkaXR5IF4wLjguMjc7CgppbXBvcnQge0VSQzIwfSBmcm9tICJAb3BlbnplcHBlbGluL2NvbnRyYWN0c0A1LjMuMC90b2tlbi9FUkMyMC9FUkMyMC5zb2wiOwppbXBvcnQge0VSQzIwUGVybWl0fSBmcm9tICJAb3BlbnplcHBlbGluL2NvbnRyYWN0c0A1LjMuMC90b2tlbi9FUkMyMC9leHRlbnNpb25zL0VSQzIwUGVybWl0LnNvbCI7Cgpjb250cmFjdCBDTXlUb2tlbiBpcyBFUkMyMCwgRVJDMjBQZXJtaXQgewogICAgY29uc3RydWN0b3IoKQogICAgICAgIEVSQzIwKHVuaWNvZGUi4biJTXlUb2tlbvCfjLsiLCAiTVRLIikKICAgICAgICBFUkMyMFBlcm1pdCh1bmljb2RlIuG4iU15VG9rZW7wn4y7IikKICAgIHt9Cn0K&lang=en&optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.30+commit.73712a01.js
Next
please advise where could I add related tests (I thought of adding 2e2 tests in
apps/remix-ide-e2e/src/tests/url.test.ts
but it seem they are disabled?