Permalink
Browse files

FilterParameter#hash_to_params: do not escape backslash. Fixes #74.

  • Loading branch information...
1 parent 59701f4 commit dcaf227dcd6f6911421784572081f3afc5fe8ba8 @bogdan bogdan committed with Jul 26, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/garb/filter_parameters.rb
  2. +2 −2 test/unit/garb/filter_parameters_test.rb
@@ -37,7 +37,7 @@ def hash_to_params(hsh)
hsh.map do |k, v|
next unless k.is_a?(SymbolOperatorMethods)
- escaped_v = v.to_s.gsub(/([,;\\])/) { |c| '\\' + c }
+ escaped_v = v.to_s.gsub(/([,;])/) { |c| '\\' + c }
"#{URI.encode(k.to_google_analytics, /[=<>]/)}#{CGI::escape(escaped_v)}"
end.join('%3B') # Hash AND (no duplicate keys), escape char for ';' fixes oauth
end
@@ -35,10 +35,10 @@ class FilterParametersTest < MiniTest::Unit::TestCase
assert_equal params, filters.to_params
end
- should "escape comma, semicolon, and backslash in values" do
+ should "escape comma, semicolon in values" do
filters = FilterParameters.new({:url.eql => 'this;that,thing\other'})
- params = {'filters' => 'ga:url%3D%3Dthis%5C%3Bthat%5C%2Cthing%5C%5Cother'}
+ params = {'filters' => 'ga:url%3D%3Dthis%5C%3Bthat%5C%2Cthing%5Cother'}
assert_equal params, filters.to_params
end

0 comments on commit dcaf227

Please sign in to comment.