Skip to content

fix(referral): stop forcing a trailing slash onto the copied referral link#1178

Draft
Blume1977 wants to merge 1 commit into
DFXswiss:developfrom
Blume1977:fix/referral-link-trailing-slash
Draft

fix(referral): stop forcing a trailing slash onto the copied referral link#1178
Blume1977 wants to merge 1 commit into
DFXswiss:developfrom
Blume1977:fix/referral-link-trailing-slash

Conversation

@Blume1977

Copy link
Copy Markdown
Contributor

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 ?. The url() 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 reads refcode/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 new url() unit tests (base kept verbatim with/without slash, joining, absolute-path-as-base).

Notes

… 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.
@Blume1977

Copy link
Copy Markdown
Contributor Author

@Yannick1712 Review-Request: Frontend-Teil zum Ref-Link-Fix (Backend-Gegenstück: DFXswiss/api#4211).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant