diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-16 12:02:37 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-16 12:02:37 +0000 |
commit | 4142e34eb17d45450d3f2792f2634e1f5ffb9c9c (patch) | |
tree | 49a606735805570bf81617f04d3259dde330ed66 | |
parent | 673a8b4859932d926051a27bd4b45c7bd3bed2b3 (diff) |
merge revision(s) 55563: [Backport #12498]
* lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque
only if the URI has path-rootless, not path-empty.
[ruby-core:76055] [Bug #12498]
patched by Chris Heisterkamp <cheister@squareup.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/uri/mailto.rb | 3 | ||||
-rw-r--r-- | test/uri/test_mailto.rb | 10 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 17 insertions, 5 deletions
@@ -1,3 +1,10 @@ +Tue Aug 16 21:01:55 2016 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque + only if the URI has path-rootless, not path-empty. + [ruby-core:76055] [Bug #12498] + patched by Chris Heisterkamp <cheister@squareup.com> + Tue Aug 16 20:59:35 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/date/date_strftime.c (date_strftime_with_tmx): reject too diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index b4405630a9..282dcbe404 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -135,6 +135,9 @@ module URI @to = nil @headers = [] + # The RFC3986 parser does not normally populate opaque + @opaque = "?#{@query}" if @query && !@opaque + unless @opaque raise InvalidComponentError, "missing opaque part for mailto URL" diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb index 9001835d28..bfe41e71fa 100644 --- a/test/uri/test_mailto.rb +++ b/test/uri/test_mailto.rb @@ -111,13 +111,15 @@ class TestMailTo < Test::Unit::TestCase bad << ["foo@example.jp?subject=1+1=2", []] ok.each do |x| - assert_equal(x[0], - @u.build(x[1]).to_s) - assert_equal(x[0], - @u.build(x[2]).to_s) + assert_equal(x[0], URI.parse(x[0]).to_s) + assert_equal(x[0], @u.build(x[1]).to_s) + assert_equal(x[0], @u.build(x[2]).to_s) end bad.each do |x| + assert_raise(URI::InvalidURIError) { + URI.parse(x) + } assert_raise(URI::InvalidComponentError) { @u.build(x) } @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 367 +#define RUBY_PATCHLEVEL 368 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 |