Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit dcaf227dcd6f6911421784572081f3afc5fe8ba8 1 parent 59701f4
@bogdan bogdan authored committed
View
2  lib/garb/filter_parameters.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
View
4 test/unit/garb/filter_parameters_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.