-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
Stringify with arrayFormat: comma, wrongfully encode comma in return #337
Comments
I believe this should be fixed with #361? |
This doesn't actually appear to have been fixed. The latest version still outputs st.equal(
qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' }),
'a=b%2Cc%2Cd',
'comma => comma'
); Surely this is wrong though, as it means you can't encode values that have commas in themselves? |
You can, it will double-encode them i believe. A PR adding those as test cases would be appreciated. |
Is there a workaround for this? |
@andredewaard it's not clear there's anything to be worked around. A PR with failing test cases would help to quickly result in an answer or a fix. |
using |
I've just tested this, and it doesn't double encode them. Which means that currently you can't send value that contain commas when using commas for the qs.stringify({ a: ['b,c', 'd,e'] }, { arrayFormat: 'comma', encode: true })
// output: a=b%2Cc%2Cd%2Ce
// decoded: a=b,c,d,e Should this issue be re-opened or a new more-specific one started? |
@Simba14 i left a review comment in november 2019, and the OP hasn't responded since. If you'd like to help, please feel free to comment on that PR with a link to an updated branch/commit (please do not open a new PR). |
wrong result with stringifying
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' })
return
a=b%2Cc
when it should return
a=b,c
because parsing
,
as reserved character per RFC 3986 should split the array if we used a parser withcomma: true
optionand
%2C
(percent encoded comma) should be treated normally as text characterrelated to : #336 pr
The text was updated successfully, but these errors were encountered: