mia-platform / mia-platform/custom-plugin-lib

Unable to use "+" character in query parameters

Open
#138 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
25
Forks
7
PR merge metrics
No merged PRs in 30d

Description

## The feature or bug you are proposing

The `+` character is removed when parameters are parsed if the params are not URL encoded. E.g. using an "email" parameter with `gbarbon+2@anemailprovider.org` value (in a GET) returns an empty array, instead of returning the array with the corresponding user.

## The description of the bug or the rationale of your proposal
More precisely, the `+` character is substituted by fastify when parsing the query params, since the `+` char in a query parameters correspond to the whitespace character (see [here](https://stackoverflow.com/questions/6855624/plus-sign-in-query-string#:~:text=%2B%20sign%20has%20a%20semantic%20meaning,pairs%20in%20the%20query%20string) for further info).

## The expected result for your bug
The plugin should encode the URL, in such a way to avoid loosing special characters when they reach fastify.

However, we're not 100% sure that the plugin should perform the encoding automatically. Please also note that this feature might be breaking if someone is inserting the `+` char in the query parameter in order to insert a whitespace on purpose.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the plugin builds GET requests and how Fastify parses their query parameters. Reproduce the email value containing `+`, then determine the intended handling for literal plus signs versus spaces; done should include verified behavior for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.