Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to parse url having multiple question mark (?) #343

Closed
Harshmakadia opened this issue Aug 8, 2022 · 1 comment
Closed

unable to parse url having multiple question mark (?) #343

Harshmakadia opened this issue Aug 8, 2022 · 1 comment

Comments

@Harshmakadia
Copy link

I have a URL, and if the user is not logged in, I store that URL in query param.

Here is how the URL looks like
http://localhost:3000/?redirectTo=https://devs-homed.mart.xyz/new-project?type=badminton&code=pitchford&sessionExpired=true

const url = http://localhost:3000/?redirectTo=https://devs-homed.mart.xyz/new-project?type=badminton&code=pitchford&sessionExpired=true

const { redirectTo } = query.parse(url);

console.log(redirectTo)
Output => https://devs-homed.mart.xyz/new-project?type=badminton

Expected => https://devs-homed.mart.xyz/new-project?type=badminton&code=pitchford&sessionExpired=true

How can I get the expected output?

I know this issue is because there is multiple question mark (?) in the URL any way I can solve this issue?

@sindresorhus
Copy link
Owner

You have to encode https://devs-homed.mart.xyz/new-project?type=badminton&code=pitchford&sessionExpired=true using encodeURIComponent.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2022
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

No branches or pull requests

2 participants