Repository navigation
fix(redirect): send App Store and Google Play URLs exactly as configured - #68
Merged
Merged
Conversation
The redirect decorated every http(s) destination like a website: UTM tags, each deep-link parameter as a query parameter, and the opt-in click id. That included the store URL chosen when a phone does not have the app. Google Play identifies the app by its own ?id=, so a link with a deep-link parameter named id replaced the app's id and Play answered 404 — the visitor saw "Error retrieving information from server" instead of the listing they needed to install from. App Store URLs carry the app id in the path and were unaffected, but gained parameters nothing reads. Store URLs (play.google.com, apps.apple.com, itunes.apple.com) are now left untouched. Nothing is lost: neither store passes query parameters to the app, and after install the deep-link data still arrives through deferred deep linking. Websites are decorated exactly as before. App-open routing is unchanged: Universal Link / App Link redirects still win, and in-app browsers are still sent to the web fallback first. The new tests assert both alongside the fix.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Before sending a visitor on, the redirect decorates the destination: it adds UTM tags, each deep-link parameter as a query parameter, and the opt-in
lf_click. That's right for a website, but it was also applied to the store URL chosen when a phone doesn't have the app.Google Play identifies the app by its own
?id=. A link with a deep-link parameter namedid, which is a common name, replaced the app's id:Play answers that with a 404. In the Play app the visitor sees "Error retrieving information from server" instead of the listing they need to install from. App Store URLs carry the app id in the path, so they kept working, but they gained parameters nothing reads.
Store URLs are now sent exactly as configured. Nothing is lost: neither store passes query parameters on to the app, and after install the deep-link data still reaches the app through deferred deep linking. Websites are decorated exactly as before.
Type of Change
Related Issues
None filed publicly; found from a user report of the Play Store error.
Changes Made
isAppStoreUrl()(exported fromsrc/routes/redirect.ts) recognisesplay.google.com,apps.apple.comanditunes.apple.com.decorateWebDestination()returns store URLs unchanged. That covers the mobile store redirect and any path where a store URL is used as a web fallback.src/routes/redirect.store-url.test.ts.Testing
npm test): 410 passed, 2 skippednpm run typecheck)Test Coverage
redirect.store-url.test.ts(8 tests, through the real route withfastify.inject()):id/routeparameters, UTM andappend_click_idisAppStoreUrl: case-insensitive, and rejects look-alike hosts (play.google.com.evil.example), store URLs inside query strings, and garbage5 of the 8 fail without the fix. The other 3 are the website and app-open guards, which describe behaviour that must not change.
npm test -- src/routes/redirect.store-url.test.tsScreenshots/Examples
Checklist
feat:,fix:)Breaking Changes
None. Store URLs no longer carry UTM tags or deep-link parameters; neither store reads them, and websites are unaffected.
Additional Notes
App-open is unchanged. This only changes the URL string of a store destination after the route has been chosen. Universal Link / App Link redirects still take priority, and in-app browsers (Gmail, Instagram, Facebook, WebViews) are still sent to the web fallback first, where a Universal Link / App Link gets a second chance to open an installed app. The existing
pickMobileFallbackUrlin-app browser tests pass unchanged, and two of the new tests assert this at route level.