[前][次][番号順一覧][スレッド一覧]

ruby-changes:43490

From: naruse <ko1@a...>
Date: Sat, 2 Jul 2016 18:05:12 +0900 (JST)
Subject: [ruby-changes:43490] naruse:r55563 (trunk): * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque

naruse	2016-07-02 18:05:05 +0900 (Sat, 02 Jul 2016)

  New Revision: 55563

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55563

  Log:
    * 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@s...>

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/mailto.rb
    trunk/test/uri/test_mailto.rb
Index: test/uri/test_mailto.rb
===================================================================
--- test/uri/test_mailto.rb	(revision 55562)
+++ test/uri/test_mailto.rb	(revision 55563)
@@ -112,13 +112,15 @@ class TestMailTo < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/uri/test_mailto.rb#L112
     bad << ["foo@e...?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)
       }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55562)
+++ ChangeLog	(revision 55563)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jul  2 18:04:24 2016  NARUSE, Yui  <naruse@r...>
+
+	* 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@s...>
+
 Sat Jul  2 04:26:14 2016  NARUSE, Yui  <naruse@r...>
 
 	* regcomp.c (noname_disable_map): don't optimize out group 0
Index: lib/uri/mailto.rb
===================================================================
--- lib/uri/mailto.rb	(revision 55562)
+++ lib/uri/mailto.rb	(revision 55563)
@@ -136,6 +136,9 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/mailto.rb#L136
       @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"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]