fix(share): replace btoa/atob with encodeURIComponent for Unicode support #1660 - #1758
Open
Tarulatapriya wants to merge 1 commit into
Open
fix(share): replace btoa/atob with encodeURIComponent for Unicode support #1660#1758Tarulatapriya wants to merge 1 commit into
Tarulatapriya wants to merge 1 commit into
Conversation
Contributor
👋 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! 🎉 |
Contributor
✅ 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. |
Author
|
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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