Double encoding of query parameters

Created on 2 March 2018, about 7 years ago
Updated 20 May 2025, about 6 hours ago

Problem/Motivation

If you add query parameters e.g. search api facet parameters to the redirect the second save of the redirect will lead to double encoded parameters.
Example:

  • Initial Input: ausflugstipps?f[0]=field_offer_types:266&f[1]=field_geo_location%253Afield_regions:9
  • First save: ausflugstipps?f%5B0%5D=field_offer_types%3A266&f%5B1%5D=field_geo_location%3Afield_regions%3A9
  • Second save: ausflugstipps?f%255B0%255D=field_offer_types%253A266&f%255B1%255D=field_geo_location%253Afield_regions%253A9

Proposed resolution

Run an urldecode() when saving the query parameters.
I propose to do this in _redirect_extract_url_options() - this is the central place where the data that are to be saved are processed.

This change should be safe since the query parameters are passed as options to url() - see redirect_redirect(). url() itself calls drupal_http_build_query() which then runs an rawurlencode() on every key & value of the query.

Remaining tasks

Reviews needed.

User interface changes

None.

API changes

Stored values might change. If other modules implement the alter hooks this could lead to unmet expectations.

Data model changes

None.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland das-peter

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024