Facet filtering on values with & (ampersand) broken

Created on 6 October 2021, over 3 years ago
Updated 18 February 2024, 11 months ago

Problem/Motivation

After updating Facet API from 7.x-1.6 to version 7.x-1.9, existing facet filters that contained values with an ampersand in them stopped working. Example: "Legal & Ethical" (no quotes of course).

On initial page load, the items with ampersands are shown in the unfiltered view, and the facet correctly shows the counts. But when one of those values is selected, no results are returned.

I notice that the "showback" of the search has replaced the & with the character entity & amp; (no space, not sure how to get the entity itself to show) instead, so instead of "Legal & Ethical" it shows "Legal & amp; Ethical".

Note that I'm filing this issue against the version of 7.x-1.9, but I did also try 7.x-1.7 and that is the first version that breaks the facets.

The URL displayed is the same in both the working case and the broken case:
[site and search URL]?f[0]field_topic_stub%3ALegal %26 Ethical

Reverting to 7.x-1.6 fixes the issue. Perhaps the patch for issue #2610702: Facet values from URL are not sanitized, but it is not made clear in the documentation that was included in 7.x-1.7 is to blame?

Let me know if I can add any info or clarify anything.

🐛 Bug report
Status

Fixed

Version

1.9

Component

Code

Created by

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