mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-21 22:54:11 +08:00
fix(search): Escape single quotes correctly
This commit is contained in:
parent
6bc42a10dc
commit
d75e7e7fac
1 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,11 @@
|
|||
_ = require 'underscore'
|
||||
{tableNameForJoin} = require '../models/utils'
|
||||
|
||||
# https://www.sqlite.org/faq.html#q14
|
||||
# That's right. Two single quotes in a row…
|
||||
singleQuoteEscapeSequence = "''"
|
||||
|
||||
|
||||
###
|
||||
Public: The Matcher class encapsulates a particular comparison clause on an {Attribute}.
|
||||
Matchers can evaluate whether or not an object matches them, and also compose
|
||||
|
@ -87,11 +92,6 @@ class Matcher
|
|||
return false
|
||||
|
||||
whereSQL: (klass) ->
|
||||
|
||||
# https://www.sqlite.org/faq.html#q14
|
||||
# That's right. Two single quotes in a row…
|
||||
singleQuoteEscapeSequence = "''"
|
||||
|
||||
if @comparator is "like"
|
||||
val = "%#{@val}%"
|
||||
else
|
||||
|
@ -214,6 +214,7 @@ class SearchMatcher extends Matcher
|
|||
searchQuery.trim()
|
||||
.replace(/^['"]/, "")
|
||||
.replace(/['"]$/, "")
|
||||
.replace(/'/g, singleQuoteEscapeSequence)
|
||||
)
|
||||
@
|
||||
|
||||
|
|
Loading…
Reference in a new issue