Skip to content

Commit

Permalink
also escaping {}
Browse files Browse the repository at this point in the history
  • Loading branch information
jasondew committed Sep 10, 2011
1 parent 06e061a commit 38302bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/data_table/mongoid.rb
Expand Up @@ -34,7 +34,7 @@ def _order_by_fields params, fields
end

def _sanitize string
string.strip.gsub(/([\^\\\/\.\+\*\?\|\[\]\(\)\$])/) { "\\#{$1}" }
string.strip.gsub(/([\^\\\/\.\+\*\?\|\[\]\(\)\{\}\$])/) { "\\#{$1}" }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/mongoid_data_table_spec.rb
Expand Up @@ -58,7 +58,7 @@
context "#_sanitize" do

it "should escape characters for the regex" do
send(:_sanitize, " ^\\/.+*?|[]()$ ").should == "\\^\\\\\\/\\.\\+\\*\\?\\|\\[\\]\\(\\)\\$"
send(:_sanitize, " ^\\/.+*?|[](){}$ ").should == "\\^\\\\\\/\\.\\+\\*\\?\\|\\[\\]\\(\\)\\{\\}\\$"
end

end
Expand Down

0 comments on commit 38302bf

Please sign in to comment.