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
to, header = @opaque.split('?', 2)
# allow semicolon as a addr-spec separator
# http://support.microsoft.com/kb/820868
unless /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ =~ to
if to.size > 0 && /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ !~ to
raise InvalidComponentError,
"unrecognised opaque part for mailtoURL: #{@opaque}"
end
test/uri/test_mailto.rb
ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}
ok[-1] << {:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}
# mailto:?subject=hi
ok << ["mailto:?subject=hi"]
ok[-1] << {:to => '', :headers => [['subject', 'hi']]}
ok[-1] << {:to => '', :headers => [['subject', 'hi']]}
ok_all = ok.flatten.join("\0")
# mailto:joe@example.com?cc=bob@example.com?body=hello ; WRONG!
    (1-1/1)