Search Block fails to convert "&" to it's equivalent HTML Entity viz., %26

Created on 26 February 2024, 9 months ago
Updated 22 July 2024, 4 months ago

Problem/Motivation

With this module, everything is working perfectly fine however, when I search for words say "test & testing", the "&" is supposed to get converted to its equivalent HTML Entity for searching viz., "%26" but somehow, the block doesn't get that in account and pass the search query as /search/node?keys=test%20&%20testing whereas it should be like /search/node?keys=test%20%26%20testing. This failure makes the query string ignore the rest of the key after "&" and yields either wrong or no results.

Additionally, the "&" takes in account very well when posted through the form on search result page, just fails to convert to html entity when posted through the search block.

Steps to reproduce

1. Add the search block in header
2. Enter the value to search in text box as "test & testing"
3. The search yields the result only for text "test" and completely ignores the rest of the text i.e. "& testing"

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India sandip27

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

Comments & Activities

  • Issue created by @sandip27
  • 🇮🇳India sandip27

    Just an update... This issue doesn't come when I am integrating the search block on plain page... but If I integrate the custom search block programatically in one of my overlay, the problem with "&" starts appearing..

  • 🇮🇳India sandip27

    Further updates, this issue appears when I set the custom search paths in the block. If I leave that field empty, then by default the search functionality searches the site and works perfectly okay with respecting the encoding of "&" for results. However, when I give the custom paths, the search module starts behaving weirdly as mentioned above.

  • 🇩🇪Germany kritika Arora

    I reproduced this issue on 8.x-1.x branch and I am getting the right URL for & Entity viz., %26 and it is also not ignores the rest of the text i.e. "& testing". In the result I am getting /search/node?keys=test%20%26%20testing.

Production build 0.71.5 2024