Skip to content

Handling of 'multiValueQuery' not respecting encoded characters #277

Closed as not planned
@vandrade-git

Description

@vandrade-git

When trying to handle multiple query parameters with encoded characters, the decoding is done before the split resulting in some weird behavior.
My example is the encoding of commas.

Normal case:
q=test-1,test-2 -> q: [ 'test-1', 'test-2']

Un-encoded comma case (seems correct):
q=test-1,test,2 -> q: [ 'test-1', 'test', '2']

Encoded comma case (seems incorrect):
q=test-1,test%2C2 -> q: [ 'test-1', 'test', '2'] when I would expect it to be q: [ 'test-1', 'test,2']

Looking at the source I can see the logic that explains why this is happening:

Current behavior:
decodeURIComponent('test-1,test%2C2').split(',')

My expected behavior:
'test-1,test%2C2'.split(',').map((c) => decodeURIComponent(c))

Is this the intended behavior or a strange edge case?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions