Project

General

Profile

Bug #5840

URI::MailTo.build - 2 of 3 examples fail on 1.9.2/1.93

Added by primerano (Tony Primerano) about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2011-07-31 revision 32789) [x86_64-darwin11.1.0]
Backport:
[ruby-core:<unknown>]

Description

The array examples of URI::MailTo.build in the documentation fail on 1.9
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI/MailTo.html

ex

ruby-1.9.3-preview1 :003 > m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
URI::InvalidComponentError: bad component(expected opaque component): john@example.com?Subject=["Ruby"]&Cc=["jack@example.com"]
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:957:in check_opaque'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:988:in
opaque='
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:198:in initialize'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/mailto.rb:135:in
initialize'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:140:in new'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:140:in
build'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/mailto.rb:122:in build'
from (irb):3
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/bin/irb:16:in
'

ruby-1.9.3-preview1 :004 > m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => 'subject', 'subscribe'})
URI::InvalidComponentError: bad component(expected opaque component): listman@example.com?subject=["subscribe"]
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:957:in check_opaque'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:988:in
opaque='
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:198:in initialize'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/mailto.rb:135:in
initialize'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:140:in new'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/generic.rb:140:in
build'
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/uri/mailto.rb:122:in build'
from (irb):4
from /Users/primerano/Developer/.rvm/rubies/ruby-1.9.3-preview1/bin/irb:16:in
'

1st example works fine.
ruby-1.9.3-preview1 :005 > m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
=> #

Associated revisions

Revision 44d72332
Added by naruse (Yui NARUSE) about 8 years ago

  • 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

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Revision 34360
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

History

#1

Updated by primerano (Tony Primerano) about 8 years ago

looking at the code it appears the header items should be a hash instead of an array. It makes for a nicer read

m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => {'subject' => 'subscribe', 'body' => 'welcome'}})
=> #

Hoping the docs will be updated instead of the code as I prefer this syntax.

#2

Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34360.
Tony, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of Ruby 1.9; use Array#join. [Bug #5840]

Also available in: Atom PDF