Skip to content

Fix redirect params placement for hash-based route URLs#13

Open
carl-wells-crowdhandler wants to merge 3 commits intomainfrom
hash-route-redirect-params
Open

Fix redirect params placement for hash-based route URLs#13
carl-wells-crowdhandler wants to merge 3 commits intomainfrom
hash-route-redirect-params

Conversation

@carl-wells-crowdhandler

redirectIfPromoted() was splitting the destination URL on '?' to append ch-* query parameters. For hash-based routes (e.g. example.com/#/path), this placed the parameters inside the hash fragment where they are invisible to window.location.search on the host domain.

The urlRedirect destination is now preserved intact while ch-* parameters are correctly appended to the query string, ensuring they are visible to the host-domain.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes redirectIfPromoted() URL rewriting so ch-* parameters are appended to the real query string (before any # fragment), ensuring they are visible via window.location.search on hash-based SPA routes.

Changes:

  • Update redirect URL construction to split out the hash fragment and append ch-* params ahead of it.
  • Regenerate/build distributed JS artifacts reflecting the new redirect behavior.
  • Update package-lock.json project metadata (version/license).

Reviewed changes

Copilot reviewed 1 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/gatekeeper/gatekeeper.ts Adjusts promoted-user redirect URL building to preserve #... while placing ch-* params in the host query string.
dist/gatekeeper/gatekeeper.js Compiled output reflecting the updated redirect logic.
dist/crowdhandler.cjs.js Bundled CJS build updated with new redirect logic (and header metadata change).
dist/crowdhandler.esm.js Bundled ESM build updated with new redirect logic (and header metadata change).
dist/crowdhandler.umd.js Bundled UMD build updated with new redirect logic (and header metadata change).
dist/crowdhandler.umd.min.js Minified UMD build updated with new redirect logic (and header metadata change).
package-lock.json Updates lockfile project metadata (version/license).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 711 to 715
for (const param of params) {
const [key] = param.split('=');
// Skip CrowdHandler parameters
if (!['ch-id', 'ch-id-signature', 'ch-requested', 'ch-code', 'ch-fresh'].includes(key)) {
existingParams.push(param);
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CrowdHandler query param key list is duplicated here and elsewhere (e.g. src/common/processURL.ts). Consider centralizing the set of ch-* keys (or a small helper) to avoid drift if new parameters are added/renamed.

Copilot uses AI. Check for mistakes.
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.

2 participants