From 44d72332014b5feac64efd25cde6d122067b7019 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 23 Jan 2012 08:12:52 +0000 Subject: [PATCH] * lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/uri/mailto.rb | 2 +- test/uri/test_mailto.rb | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bde3d8e657..3a65a3afff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 23 17:06:17 2012 NARUSE, Yui + + * lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of + Ruby 1.9; use Array#join. [Bug #5840] + Mon Jan 23 16:42:28 2012 NARUSE, Yui * io.c (extract_binmode): raise an exception if binmode/textmode diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index 765528fb7f..079340cf58 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -103,7 +103,7 @@ module URI if tmp[:headers].kind_of?(Array) tmp[:opaque] << tmp[:headers].collect { |x| if x.kind_of?(Array) - x[0] + '=' + x[1..-1].to_s + x[0] + '=' + x[1..-1].join else x.to_s end diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb index 04fb6fdadc..c2158845e8 100644 --- a/test/uri/test_mailto.rb +++ b/test/uri/test_mailto.rb @@ -82,6 +82,16 @@ class TestMailTo < Test::Unit::TestCase ok[-1] << {:to => "unlikely%3Faddress@example.com", :headers => ["blat=foop"]} + # mailto:john@example.com?Subject=Ruby&Cc=jack@example.com + ok << ["mailto:john@example.com?Subject=Ruby&Cc=jack@example.com"] + ok[-1] << ['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]] + ok[-1] << {:to=>"john@example.com", :headers=>[["Subject", "Ruby"], ["Cc", "jack@example.com"]]} + + # mailto:listman@example.com?subject=subscribe + ok << ["mailto:listman@example.com?subject=subscribe"] + ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]} + ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]} + ok_all = ok.flatten.join("\0") # mailto:joe@example.com?cc=bob@example.com?body=hello ; WRONG!