Facet checkbox links do not encode + as %2B, breaking filters with + in the value

Created on 5 August 2025, 3 days ago

Problem/Motivation

Facet checkbox links (using the “List of checkboxes” widget) do not properly encode special characters in query parameters, specifically the + symbol.

When a facet value includes a +, such as I+D, the URL generated after selecting the checkbox includes it as-is (+) instead of URL-encoding it to %2B. This results in the value being interpreted as a space ( ) instead of a plus, which breaks the filtering.

This bug affects the accuracy of the filtering functionality when facet values contain + or other special characters.

Steps to reproduce

  1. Create a Facet using the List of checkboxes widget.
  2. Index a content item with a taxonomy term (or other field) that includes a + in its value, e.g., I+D.
  3. Go to the page where the facet is displayed.
  4. Select the checkbox for the value that contains +.
  5. Observe the resulting URL:
    • Actual: ?f[0]=field_name:I+D
    • Expected: ?f[0]=field_name:I%2BD

Proposed resolution

This issue is currently mitigated with a temporary workaround, which is provided as a patch attached to this issue. The workaround ensures that query parameters used in facet checkbox links are correctly encoded — particularly characters like +, which are currently not encoded and therefore misinterpreted.

The patch modifies the facets_filter.facets JavaScript behavior to apply encodeURIComponent() to all query parameter values before redirecting.

This is not intended as a permanent fix but can be used to prevent broken filters until a proper solution is implemented in the module.

🐛 Bug report
Status

Active

Version

1.8

Component

Code

Created by

🇪🇸Spain evamtinez

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

Comments & Activities

Production build 0.71.5 2024