Project

General

Profile

Actions

Bug #12212

closed

Parsing a URI of "mailto:?subject=hi" with `URI.parse` raises an exception

Added by madeofcode (Mark Dodwell) over 8 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:74527]

Description

Parsing a URI of "mailto:?subject=hi" with URI.parse raises an exception. I believe this is a valid "mailto" URI, as defined in RFC6068.

Behavior observed:

>> URI.parse("mailto:?subject=hi")
NoMethodError: undefined method `split' for nil:NilClass

Behavior expected:

>> uri = URI.parse("mailto:?subject=hi")
=> #<URI::MailTo URL:mailto:?subject=hi>
>> uri.to
=> ""
>> uri.headers
=> [["subject", "hi"]]

Reference from RFC6068 than defines the "to" element as optional:

mailtoURI = "mailto:" [ to ] [ hfields ]

https://tools.ietf.org/html/rfc6068#section-2

Patch attached.


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0