Skip to content

fix(share): replace btoa/atob with encodeURIComponent for Unicode support #1660 - #1758

Open
Tarulatapriya wants to merge 1 commit into
reframe-oss:mainfrom
Tarulatapriya:fix/btoa-unicode-crash
Open

fix(share): replace btoa/atob with encodeURIComponent for Unicode support #1660#1758
Tarulatapriya wants to merge 1 commit into
reframe-oss:mainfrom
Tarulatapriya:fix/btoa-unicode-crash

Conversation

@Tarulatapriya

Copy link
Copy Markdown

Description

This PR addresses issue #1660 where btoa throws an InvalidCharacterError when the user includes Unicode characters (like emojis or non-Latin text) in the editor state and attempts to copy the share link.

Fixes Made:

  • Encoding/Decoding: Replaced btoa(JSON.stringify(recipe)) with encodeURIComponent(JSON.stringify(recipe)) in VideoEditor.tsx and useVideoEditor.ts.
  • Backward Compatibility: Updated decodeRecipe to safely attempt decoding via decodeURIComponent first. If the decoded string isn't a valid JSON object (meaning the link was generated with the old base64 method), it gracefully falls back to atob(encoded). This guarantees that existing share links out in the wild will not break!

Related Issues

Fixes #1660
Fixes #1725

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Backwards compatible enhancement

Additional Notes

  • Contributing under GSSoC 2026.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Tarulatapriya!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

🟠 GSSoC'26 PR detected — thanks for contributing under GirlScript Summer of Code 2026!

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @Tarulatapriya

Basic 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.

@github-actions github-actions Bot added level:advanced Advanced level - 55 pts type:bug Bug fix type:feature New feature gssoc'26 GirlScript Summer of Code 2026 labels Aug 30, 2026
@Tarulatapriya

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc'26 GirlScript Summer of Code 2026 level:advanced Advanced level - 55 pts type:bug Bug fix type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] btoa crashes on Unicode characters in Copy Link

1 participant