mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 20:04:18 +08:00
FIX: replace curly quotes to regular quotes in search terms
This commit is contained in:
parent
920571ae07
commit
ff6dda85b7
@ -129,6 +129,8 @@ class Search
|
||||
|
||||
# Removes any zero-width characters from search terms
|
||||
term.to_s.gsub!(/[\u200B-\u200D\uFEFF]/, '')
|
||||
# Replace curly quotes to regular quotes
|
||||
term.to_s.gsub!(/[\u201c\u201d]/, '"')
|
||||
@clean_term = term.to_s.dup
|
||||
|
||||
term = process_advanced_search!(term)
|
||||
|
@ -71,6 +71,17 @@ describe Search do
|
||||
expect(search.clean_term).to eq('capybara')
|
||||
end
|
||||
|
||||
it 'replaces curly quotes to regular quotes in search terms' do
|
||||
term = '“discourse”'
|
||||
|
||||
expect(term == '"discourse"').to eq(false)
|
||||
|
||||
search = Search.new(term)
|
||||
expect(search.valid?).to eq(true)
|
||||
expect(search.term).to eq('"discourse"')
|
||||
expect(search.clean_term).to eq('"discourse"')
|
||||
end
|
||||
|
||||
it 'does not search when the search term is too small' do
|
||||
search = Search.new('evil', min_search_term_length: 5)
|
||||
search.execute
|
||||
|
Loading…
x
Reference in New Issue
Block a user