ruby / ruby/uri

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

Open
#238 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
125
Forks
65
Avg merge
6h 4m
Merged PRs (30d)
2

Description

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 3fdc4b678f22651e1c52aaa4beb618786570d34f

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the URI::MailTo.build entry point and compare its handling of the supplied special characters with RFC 6068 section 2. Confirm that the example produces the expected percent-encoded mailto URI without raising InvalidComponentError; the referenced Rails PR and 2014 commit provide additional context.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.