diff options
author | Shawn Veader <shawn@veader.org> | 2012-09-10 17:50:04 -0300 |
---|---|---|
committer | Shawn Veader <shawn@veader.org> | 2012-10-26 15:43:07 -0400 |
commit | f96b410bc7e81fee98752dd7d715791fae5b2378 (patch) | |
tree | 8e08c50426d1ce3597ef99b08a0c54d3eeda0e5b /activerecord/lib | |
parent | 6ac33f9e4b4dbfe34f9884d7b262a7ba2c3356e1 (diff) | |
download | rails-f96b410bc7e81fee98752dd7d715791fae5b2378.tar.gz rails-f96b410bc7e81fee98752dd7d715791fae5b2378.tar.bz2 rails-f96b410bc7e81fee98752dd7d715791fae5b2378.zip |
Decode attributes pulled from URI.parse
The RFC indicates that username and passwords may be encoded.
http://tools.ietf.org/html/rfc2396#section-3.2.2
Found this trying to use the mysql://username:password@host:port/db and having special characters in the password which needed to be URI encoded.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/connection_specification.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index b9a61f7d91..09250d3c01 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -73,6 +73,8 @@ module ActiveRecord :database => config.path.sub(%r{^/},""), :host => config.host } spec.reject!{ |_,value| value.blank? } + uri_parser = URI::Parser.new + spec.map { |key,value| spec[key] = uri_parser.unescape(value) if value.is_a?(String) } if config.query options = Hash[config.query.split("&").map{ |pair| pair.split("=") }].symbolize_keys spec.merge!(options) |