Url_helper mail_to escapes @ as %40 in cc and bcc elements

I’ve run into an annoying inconsistency between the mail_to method’s
documentation and its implementation. This would be an easy fix if
the documentation was incorrect, but it seems that the implementation
is the one using the wrong method.

Contrary to the documentation of url_helper’s mailto, bcc and cc
elements are CGI.escape()d, which seems to replace everything not
alphanumeric with a %-encoding, including transforming @ to %40. This
behavior is in contrast to what seems to be the original patch to
enable cc and bcc handling, which called URI.escape.


My read of a proto-specification of mailto (http://ietfreport.isoc.org/
idref/draft-duerst-mailto-bis/) suggests that @ signs are preferred;
one of my users runs a client that choked on the %40. What I’d like
to ask for is:

a) A suggestion as to how to override the behavior of mail_to as a
workaround. Effectively, where do I put a method named mail_to ? and
how do I invoke the original one before gsub(/%40/,’@’))? Or should
I freeze and edit?

b) A hint as to how to best submit a patch (or whether it’s worth
writing one). Clearly the documentation of the method is inconsistent
with its behavior. It looks like the original patch, when applied by
david heinemeier hansson was transformed to use CGI.escape, that a
test was written to check for %40 as the goal, but the documentation
was left alone to imply that @ syntax would be used.



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs