Skip to content

Commit

Permalink
Changed Faraday::Utils#escape to use block parameter instead of $1 to…
Browse files Browse the repository at this point in the history
… sidestep a bug in ActiveSupport::SafeBuffer#gsub in Rails 3.1 (as described in rails/rails#3496)
  • Loading branch information
radanskoric authored and mislav committed Dec 30, 2011
1 parent af27532 commit 3844d3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/faraday/utils.rb
Expand Up @@ -125,8 +125,8 @@ def build_nested_query(value, prefix = nil)
# Be sure to URI escape '+' symbols to %2B. Otherwise, they get interpreted
# as spaces.
def escape(s)
s.to_s.gsub(/([^a-zA-Z0-9_.-]+)/n) do
'%' << $1.unpack('H2'*bytesize($1)).join('%').tap { |c| c.upcase! }
s.to_s.gsub(/([^a-zA-Z0-9_.-]+)/n) do |match|
'%' << match.unpack('H2'*bytesize(match)).join('%').tap { |c| c.upcase! }
end
end

Expand Down

0 comments on commit 3844d3a

Please sign in to comment.