Permalink
Browse files

Quick fix for not escaping []s (not ideal)

  • Loading branch information...
josh committed Dec 2, 2009
1 parent 1ee9b40 commit 856d2fd874d72dd9f83204affff4edfef3308361
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/object/to_query.rb
@@ -7,7 +7,7 @@ class Object
# Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
def to_query(key)
require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
- "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
+ "#{CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') }}=#{CGI.escape(to_param.to_s)}"
end
end

0 comments on commit 856d2fd

Please sign in to comment.