fix(share): replace btoa/atob with encodeURIComponent for Unicode support #1660 - #1758
Conversation
👋 Thanks for your PR, @Tarulatapriya!Welcome to Reframe — a browser-based video editor built for everyone 🎬
What happens next
Quick checklist
Useful links
Happy coding! 🎉 |
✅ PR Format Check Passed — @TarulatapriyaBasic format checks passed. A maintainer will review your code changes. This does not mean the PR is approved — it just means the format is correct. |
|
Hey @saurabhhhcodes 👋 (GSSoC '26) I've fixed this bug by replacing btoa/atob with encodeURIComponent/decodeURIComponent to fully support Unicode characters and emojis. I also added a backward-compatibility fallback in decodeRecipe: it defaults to the new decoding method, but falls back to atob for old base64 share links, so existing URLs won't break for users! Let me know if this looks good to merge! |
# Conflicts: # src/hooks/useVideoEditor.ts
✅ Deploy Preview for reframe-os ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Description
This PR addresses issue #1660 where
btoathrows anInvalidCharacterErrorwhen the user includes Unicode characters (like emojis or non-Latin text) in the editor state and attempts to copy the share link.Fixes Made:
btoa(JSON.stringify(recipe))withencodeURIComponent(JSON.stringify(recipe))inVideoEditor.tsxanduseVideoEditor.ts.decodeRecipeto safely attempt decoding viadecodeURIComponentfirst. If the decoded string isn't a valid JSON object (meaning the link was generated with the old base64 method), it gracefully falls back toatob(encoded). This guarantees that existing share links out in the wild will not break!Related Issues
Fixes #1660
Fixes #1725
Type of Change
Additional Notes