If a search URL has spaces encoded as plus signs (+), they aren't decoded before the query is sent to Google. Also, they will be added in the form on the results page. For example: search/google?query=web+developer will be searched as the literal "web+developer", which will also be the pre-filled value of the keywords input on the page.

This patch will replace + with %20 prior to calling decodeURIComponent().

This solution is based on the answer here: https://stackoverflow.com/a/24417399

CommentFileSizeAuthor
url-query-plus-spaces.patch443 bytesbyrond

Comments

byrond created an issue. See original summary.

byrond’s picture

Issue summary: View changes
lreynaga’s picture

Status: Needs review » Reviewed & tested by the community

Patch works as intended. Thanks.

  • mark_fullmer committed ef6e998 on 8.x-3.x authored by byrond
    Issue #3091656 by byrond, lreynaga: Spaces encoded as plus in URL aren't...
mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.