summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2021-10-03 19:44:39 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2021-10-03 19:44:39 +0000
commit05e9d7883b6bf6dc556196a75b6ab8e389d834e2 (patch)
tree4faf6589808c4a580a5f5d0223d6142b8e32c461 /test/unit/issue_test.rb
parent65f31d52cdd612407200f6af9045fa682345fab8 (diff)
downloadredmine-05e9d7883b6bf6dc556196a75b6ab8e389d834e2.tar.gz
redmine-05e9d7883b6bf6dc556196a75b6ab8e389d834e2.zip
Use sanitize_sql_like in like scopes (#35073).
Patch Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@21231 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index e298f4d68..12a63438d 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -3406,4 +3406,20 @@ class IssueTest < ActiveSupport::TestCase
assert_equal [5], issue2.filter_projects_scope('').ids.sort
end
+
+ def test_like_should_escape_query
+ issue = Issue.generate!(:subject => "asdf")
+ r = Issue.like('as_f')
+ assert_not_include issue, r
+ r = Issue.like('as%f')
+ assert_not_include issue, r
+
+ issue = Issue.generate!(:subject => "as%f")
+ r = Issue.like('as%f')
+ assert_include issue, r
+
+ issue = Issue.generate!(:subject => "as_f")
+ r = Issue.like('as_f')
+ assert_include issue, r
+ end
end