diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-27 11:13:31 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-27 11:13:31 +0000 |
commit | 4919dbabdb4042fee8cb3fb03c66536b1b032035 (patch) | |
tree | b56eac56d072aa089365945d61e0640c51d87648 /lib | |
parent | ddd7dd0f8cb255f81603de6e0656f0fd0c245804 (diff) |
merge revision(s) 56139,57066,57099,57100: [Backport #10774]
* lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
with class method.
* test/uri/test_mailto.rb: Added tests for coverage.
Use URI.decode_www_form_component [Bug #10774]
`parser` refered RFC2396_Parser, but it is separated.
test is contributed by Dominik Menke
test_mailto.rb: adjust scope
test_mailto.rb: overwritten methods
* test/uri/test_mailto.rb (URI::TestMailTo#test_to_mailtext):
merge overwritten methods. [Bug #10774]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uri/mailto.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index 7299550d3f..1494c3952b 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -84,7 +84,7 @@ module URI # puts m3.to_s -> mailto:listman@example.com?subject=subscribe # def self.build(args) - tmp = Util::make_components_hash(self, args) + tmp = Util.make_components_hash(self, args) case tmp[:to] when Array @@ -118,7 +118,7 @@ module URI end end - return super(tmp) + super(tmp) end # @@ -187,7 +187,7 @@ module URI end end - return true + true end private :check_to @@ -214,7 +214,7 @@ module URI "bad component(expected opaque component): #{v}" end - return true + true end private :check_headers @@ -267,22 +267,22 @@ module URI # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" # def to_mailtext - to = parser.unescape(@to) + to = URI.decode_www_form_component(@to) head = '' body = '' @headers.each do |x| case x[0] when 'body' - body = parser.unescape(x[1]) + body = URI.decode_www_form_component(x[1]) when 'to' - to << ', ' + parser.unescape(x[1]) + to << ', ' + URI.decode_www_form_component(x[1]) else - head << parser.unescape(x[0]).capitalize + ': ' + - parser.unescape(x[1]) + "\n" + head << URI.decode_www_form_component(x[0]).capitalize + ': ' + + URI.decode_www_form_component(x[1]) + "\n" end end - return "To: #{to} + "To: #{to} #{head} #{body} " |