summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 17:23:34 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 17:23:34 +0000
commit7892ad93b69de399626ce189459addee81c1ad6e (patch)
tree95c31f0184195532044a6d5b7059c900b49fa457
parent387cc5166fcdc4d5a8039c9a31b82d5019149c90 (diff)
merge revision(s) 49254: [Backport #10738]
* lib/uri/mailto.rb: raising URI::InvalidComponentError instead of failing with undefined method `split' for nil:NilClass for mailto: URIs without opaque part. [Bug #10738] * test/uri/testuri.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/uri/mailto.rb4
-rw-r--r--test/uri/test_mailto.rb3
-rw-r--r--version.h2
4 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bceddb5bc..8f43f3b261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Mar 29 02:22:35 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * lib/uri/mailto.rb: raising URI::InvalidComponentError instead
+ of failing with undefined method `split' for nil:NilClass for
+ mailto: URIs without opaque part. [Bug #10738]
+ * test/uri/testuri.rb: Test for above
+
Tue Mar 29 02:08:40 2016 Koichi Sasada <ko1@atdot.net>
* signal.c: should also clear ruby_disable_gc.
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb
index 497d9630d2..b4405630a9 100644
--- a/lib/uri/mailto.rb
+++ b/lib/uri/mailto.rb
@@ -135,6 +135,10 @@ module URI
@to = nil
@headers = []
+ unless @opaque
+ raise InvalidComponentError,
+ "missing opaque part for mailto URL"
+ end
to, header = @opaque.split('?', 2)
# allow semicolon as a addr-spec separator
# http://support.microsoft.com/kb/820868
diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb
index 661f7f7a9c..9001835d28 100644
--- a/test/uri/test_mailto.rb
+++ b/test/uri/test_mailto.rb
@@ -104,6 +104,9 @@ class TestMailTo < Test::Unit::TestCase
# mailto:javascript:alert()
bad << ["javascript:alert()", []]
+ # mailto:/example.com/ ; WRONG, not a mail address
+ bad << ["/example.com/", []]
+
# '=' which is in hname or hvalue is wrong.
bad << ["foo@example.jp?subject=1+1=2", []]
diff --git a/version.h b/version.h
index dacda44796..7d80b606df 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.5"
#define RUBY_RELEASE_DATE "2016-03-29"
-#define RUBY_PATCHLEVEL 283
+#define RUBY_PATCHLEVEL 284
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3