Escape search term before passing it to Regexp.new (!6241)
This commit is contained in:
parent
0e3f7927d5
commit
e64e45db54
2 changed files with 4 additions and 1 deletions
|
@ -10,6 +10,7 @@ v 8.12.0 (unreleased)
|
||||||
- Change logo animation to CSS (ClemMakesApps)
|
- Change logo animation to CSS (ClemMakesApps)
|
||||||
- Instructions for enabling Git packfile bitmaps !6104
|
- Instructions for enabling Git packfile bitmaps !6104
|
||||||
- Fix pagination on user snippets page
|
- 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
|
- Change merge_error column from string to text type
|
||||||
- Reduce contributions calendar data payload (ClemMakesApps)
|
- Reduce contributions calendar data payload (ClemMakesApps)
|
||||||
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
|
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
|
||||||
|
|
|
@ -7,8 +7,10 @@ module SearchHelper
|
||||||
projects_autocomplete(term)
|
projects_autocomplete(term)
|
||||||
].flatten
|
].flatten
|
||||||
|
|
||||||
|
search_pattern = Regexp.new(Regexp.escape(term), "i")
|
||||||
|
|
||||||
generic_results = project_autocomplete + default_autocomplete + help_autocomplete
|
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,
|
resources_results,
|
||||||
|
|
Loading…
Reference in a new issue