fix(referral): stop forcing a trailing slash onto the copied referral link#1178
Draft
Blume1977 wants to merge 1 commit into
Draft
fix(referral): stop forcing a trailing slash onto the copied referral link#1178Blume1977 wants to merge 1 commit into
Blume1977 wants to merge 1 commit into
Conversation
… link The url() helper normalizes the base to end with a slash so that path joining works, but with an empty path the slash leaked into the result: the account screen copied https://dfx.swiss/app/services/?code=... since May 2025. dfx.swiss only redirects the slash-less form to the API ref endpoint, so every freshly copied referral link silently lost its code. With no path to join, the base is now used exactly as provided. Path joining is unchanged; covered by new url() tests.
Contributor
Author
|
@Yannick1712 Review-Request: Frontend-Teil zum Ref-Link-Fix (Backend-Gegenstück: DFXswiss/api#4211). |
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.
Problem
Since the URL-construction refactor in #587 (May 2025), the account screen's referral copy button produces
https://dfx.swiss/app/services/?code=XXX-XXX— with a trailing slash before the?. Theurl()helper normalizes the base to end with a slash for path joining, and with an empty path the slash leaks into the result.dfx.swiss only 301-redirects the slash-less form to
api.dfx.swiss/v1/app/services?code=…(where the ref is stored per IP); the slash form returns the static marketing page (HTTP 200) and the code is lost — no meta refresh, no script forwards it, and the app itself only readsrefcode/special-code/recommendation-code. Every freshly copied referral link therefore silently loses its attribution.Fix
With no path to join,
url()now uses the base exactly as provided (new URL(base)); path joining is unchanged. Covered by newurl()unit tests (base kept verbatim with/without slash, joining, absolute-path-as-base).Notes