Skip to content

URI::MailTo.build does not percent-encode addresses (contrary to RFC 6068) #238

Description

@amomchilov

URI::MailTo raises InvalidComponentError when given these special symbols, which RFC 6068, section 2 requires be percent-encoded.

URI::MailTo.build(to: "#!$%&'*+-/=?^_`{}|@example.org")
# unrecognised opaque part for mailtoURL: #!$%&'*+-/=?^_`{}|@example.org (URI::InvalidComponentError)
# expected: mailto:%23%21%24%25%26%27%2A%2B-%2F%3D%3F%5E_%60%7B%7D%7C@example.org
  • For reference, see this PR which implemented this behaviour in Rails' ActionView (though Rails has its own URI generation logic, and doesn't use URI::MailTo).
  • This logic was last changed back in 2014 in 3fdc4b6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions