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

(adapter-netlify) Query params containing commas split after first comma #1466

Closed
adamjkb opened this issue May 16, 2021 · 0 comments · Fixed by #1467
Closed

(adapter-netlify) Query params containing commas split after first comma #1466

adamjkb opened this issue May 16, 2021 · 0 comments · Fixed by #1467
Labels
bug Something isn't working pkg:adapter-netlify

Comments

@adamjkb
Copy link
Contributor

adamjkb commented May 16, 2021

Describe the bug
A query parameter is split after the first comma if it contains a comma. For example if the query parameter is A string, with a comma / ?comma=A string%2C containing comma. The page will only receive A string as its query params.

To Reproduce
Repo: https://github.com/adamjkb/sveltekit-query-parsing
Deployed Netlify example: https://sveltekit-query-parsing.netlify.app/?comma=A%20string%2C%20containing%20comma&simple=Simple%20string

Expected behavior
To receive full query parameters

Additional context
The issue is caused by the following line in the adapter

const query = new URLSearchParams();
for (const k in queryStringParameters) { // queryStringParameters = {"q": "A string, with comma"}
  const value = queryStringParameters[k];
  value.split(', ').forEach((v) => {
	  query.append(k, v);
  });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:adapter-netlify
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants