Skip to content

Conversation

CoveMB
Copy link
Contributor

@CoveMB CoveMB commented Sep 19, 2025

Title

  • Update UTF-8 base64 decoding for code URL param to use TextDecoder; add e2e coverage

Summary

  • Replaces ad‑hoc percent-escape base64 decoding with a standards-based TextDecoder approach when loading code from the ?code= URL parameter.
  • Adds an e2e test that covers ASCII punctuation, URL-encoded characters, and Unicode (including emoji)

Problem

  • Loading code from the code URL param could fail to correctly decode content containing:
    • ASCII punctuation and special URL-encoded characters.
  • The prior implementation constructed a percent-escaped string from atob() bytes and then used decodeURIComponent, which is error-prone for arbitrary UTF‑8.

Scope

  • libs/remix-ui/workspace/src/lib/actions/workspace.ts: Replace decoder implementation and update usage.
  • apps/remix-ide-e2e/src/tests/url.test.ts: Add a new test covering special chars, punctuation, and persistence behavior.

Changes

  • Rename and replace decoder:
    • Old: decodePercentEscapedBase64(b64Payload)
    • New: decodeBase64(b64Payload) using TextDecoder('utf-8')
  • Updated code path where params.code is processed to use the new decoder.
  • Added e2e test “Should load the code from URL & code params with ASCII punctua
    tion and special character #group1” that:
    • Visits Remix with a #code= payload containing special characters and emoji
      .
    • Ensures the decoded content matches expected substrings.
    • Verifies “code-sample” workspace is not persisted after returning to the app
      root.

Implementation Details

  • Decoding flow now:
    • decodeURIComponent(b64Payload)atob()Uint8Array.from()new Tex tDecoder().decode(bytes).
  • This follows a robust, standards-based UTF‑8 decode path and avoids manual per
    cent-encoding reconstruction.

Backward Compatibility

  • No user-facing breaking changes expected.
  • Internal function rename from decodePercentEscapedBase64 to decodeBase64 i
    s contained within the same module with its usage updated. No external API chang
    es anticipated.

Note

Copy link

netlify bot commented Sep 19, 2025

Deploy Preview for reliable-cocada-166884 ready!

Name Link
🔨 Latest commit 0449b28
🔍 Latest deploy log https://app.netlify.com/projects/reliable-cocada-166884/deploys/68d175c33f3beb00084320b8
😎 Deploy Preview https://deploy-preview-6390--reliable-cocada-166884.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@CoveMB
Copy link
Contributor Author

CoveMB commented Sep 22, 2025

Hello, let me know if the MR need anything else @Aniket-Engg

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.

1 participant