CN-1078: Fix: Removing double decoding of goToURL in LL #9226
+11
−6
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.
✅ Checklist
npx changeset
was attached.📝 Description
This PR fixes a bug where the
goToURL
parameter passed by thebuy-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
fromLiveAppExchange
extracts and passes thesearchParams
usingsearchParams.entries
which by default decodes the URL value, and then down the hierarchy of componentsgetInitialURL
usesdecodeURIComponent
to decode again thegoToURL
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 fromgetIinitialURL
but add a decode on LLM when the url gets passed throughcustomParams
in the PTX screen as that does not usessearchParams
utility so there is no decoding by default.❓ Context
🧐 Checklist for the PR Reviewers