Commit e64e45db authored by 🕺 Winnie 🕺's avatar 🕺 Winnie 🕺

Escape search term before passing it to Regexp.new (!6241)

parent 0e3f7927
......@@ -10,6 +10,7 @@ v 8.12.0 (unreleased)
- Change logo animation to CSS (ClemMakesApps)
- Instructions for enabling Git packfile bitmaps !6104
- Fix pagination on user snippets page
- Escape search term before passing it to Regexp.new !6241 (winniehell)
- Change merge_error column from string to text type
- Reduce contributions calendar data payload (ClemMakesApps)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
......
......@@ -7,8 +7,10 @@ module SearchHelper
projects_autocomplete(term)
].flatten
search_pattern = Regexp.new(Regexp.escape(term), "i")
generic_results = project_autocomplete + default_autocomplete + help_autocomplete
generic_results.select! { |result| result[:label] =~ Regexp.new(term, "i") }
generic_results.select! { |result| result[:label] =~ search_pattern }
[
resources_results,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment