inveniosoftware / react-searchkit

React component library for interacting with a REST API.
https://inveniosoftware.github.io/react-searchkit/
MIT License
78 stars 40 forks source link

Query string quotes stripped out from URL #176

Closed ntarocco closed 3 years ago

ntarocco commented 3 years ago

Describe the bug

Quotes are removed from the URL in query string.

Steps to Reproduce

  1. Opening the RSK app with a query string with quotes, e.g. /search?q="Superconducting"
  2. Check the search bar, it has as query string only Superconducting

Expected behavior

In the search bar, we should have "Superconducting"

Additional context

The issue is the function const _value = JSON.parse(value); in the UrlParser that is stripping out the quotes. The function JSON.parse was chosen because it will cast int/bool to the the right type. See here an example to reproduce it.

tiborsimko commented 3 years ago

The issue concerns also other special characters, for example the following query:

$ firefox 'https://sandbox-cds-ils.web.cern.ch/search?q=10.7483%2FOPENDATA.9S5F.BY3B'

leads to q=10 being retained only.