Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CN-1078: Fix: Removing double decoding of goToURL in LL #9226

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

adammino-ledger
Copy link
Contributor

@adammino-ledger adammino-ledger commented Feb 13, 2025

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • the goToURL passed to LL to be opened in an iFrame or webview is now decoded just once.

📝 Description

This PR fixes a bug where the goToURL parameter passed by the buy-sell-ui to Ledger Live was decoded twice causing issues on URLs that contain a signature with special characters (e.g. AlchemyPay).

For reference, on LLD, URLSearchParams from LiveAppExchange extracts and passes the searchParams using searchParams.entries which by default decodes the URL value, and then down the hierarchy of components getInitialURL uses decodeURIComponent to decode again the goToURL value.

The bug was not visible till we had a use case where a URL from a live app was containing special characters (+) because decoding twice a URL without special chars would return the same URL with no complications. With the + though the URL would break when opened in an iFrame/Webview or browser as the + would need to be encoded in order to work( what happened with AlchemyPay ).

In order to fix this i kept the default decoding from searchParams.entries in LLD that let you extract and decode in a clean way the URLs, remove the extra decoding from getIinitialURL but add a decode on LLM when the url gets passed through customParams in the PTX screen as that does not uses searchParams utility so there is no decoding by default.

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

…d by default function on LLD, added the decode on LLM for customParams
@adammino-ledger adammino-ledger added the WIP Work in progress label Feb 13, 2025
@adammino-ledger adammino-ledger requested review from a team as code owners February 13, 2025 16:10
@live-github-bot live-github-bot bot added mobile Has changes in LLM common Has changes in live-common labels Feb 13, 2025
Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Feb 17, 2025 10:37am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Feb 17, 2025 10:37am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Feb 17, 2025 10:37am
web-tools ⬜️ Ignored (Inspect) Visit Preview Feb 17, 2025 10:37am

@adammino-ledger adammino-ledger removed the WIP Work in progress label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common mobile Has changes in LLM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants