Project

General

Profile

Bug #12212 ยป fix-uri-mailto-parsing-blank-to-with-query.patch

madeofcode (Mark Dodwell), 03/24/2016 08:56 AM

View differences:

lib/uri/mailto.rb
143 143
      to, header = @opaque.split('?', 2)
144 144
      # allow semicolon as a addr-spec separator
145 145
      # http://support.microsoft.com/kb/820868
146
      unless /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ =~ to
146
      if to.size > 0 && /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ !~ to
147 147
        raise InvalidComponentError,
148 148
          "unrecognised opaque part for mailtoURL: #{@opaque}"
149 149
      end
test/uri/test_mailto.rb
97 97
    ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}
98 98
    ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}
99 99

  
100
    # mailto:?subject=hi
101
    ok << ["mailto:?subject=hi"]
102
    ok[-1] << {:to => '', :headers => [['subject', 'hi']]}
103
    ok[-1] << {:to => '', :headers => [['subject', 'hi']]}
104

  
100 105
    ok_all = ok.flatten.join("\0")
101 106

  
102 107
    # mailto:joe@example.com?cc=bob@example.com?body=hello   ; WRONG!
103
-