Issue #12212 has been reported by Mark Dodwell. ---------------------------------------- Bug #12212: Parsing a URI of "mailto:?subject=hi" with `URI.parse` raises an exception https://bugs.ruby-lang.org/issues/12212 * Author: Mark Dodwell * Status: Open * Priority: Normal * Assignee: * ruby -v: trunk * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- 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: ```ruby >> URI.parse("mailto:?subject=hi") NoMethodError: undefined method `split' for nil:NilClass ``` Behavior expected: ```ruby >> 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-------------------------------- fix-uri-mailto-parsing-blank-to-with-query.patch (1.52 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>