Closed Bug 160055 Opened 22 years ago Closed 21 years ago

Copy Email Address should unescape e.g. %40 to @

Categories

(SeaMonkey :: UI Design, defect)

x86
Windows 2000
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aha, Assigned: bugzilla)

References

()

Details

(Keywords: polish, testcase)

Attachments

(2 files, 2 obsolete files)

Repro:
1. open testcase 
2. in context menu for e-mail link choose Copy Email Address

Actual:
in clipboard is string 'info%40mozilla.org'

Expected:
in clipboard should be string 'info@mozilla.org'

2002072818/trunk/W2K
Attached file testcase
Keywords: testcase
The issue is broader than specified in the Summary.

Better title:
"Copy Email Address should unescape encoded characters (e.g., %40 to '@')"

The case that brought me here demonstrates greater annoyance:

1. browse to http://www.pcnineoneone.com/downloads/games.html
2. scroll to base of document
3. right-click on the word 'Webmaster'
4. select 'Copy Email Address' from context menu
5. paste into another application (I used PINE)

Result:

"%57%65%62%6D%61%73%74%65%72%40%50%43%4E%69%6E%65%4F%6E%65%4F%6E%65%2E%63%6F%6D"

In a word, "Argh!"

People do this sort of thing to fool email-grabbin'
spiders. I'd just release a spider that unescapes
encoded characters in HREF values beginning with the
mailto: pseudo-protocol, but whatever floats other
people's boats...

btw, I see this with a Mozilla nightly, build id 2002090608
on Windows 98 -- I'm guessing the problem is not specific to
Windows 2000 as indicated in the original report.
Attached patch Proposed patch (obsolete) — Splinter Review
Attachment #109826 - Flags: superreview?(jaggernaut)
Attachment #109826 - Flags: review?(blaker)
Keywords: patch, polish, review, ui
Summary: Copy Email Address should convert %40 to @ → Copy Email Address should unescape e.g. %40 to @
Attachment #109826 - Flags: review?(blake) → review?(dean_tessman)
Comment on attachment 109826 [details] [diff] [review]
Proposed patch

Components.interfaces.nsIClipboardHelper );
>-        clipboard.copyString(addresses);
>+        clipboard.copyString(unescape(addresses));

Am I right in assuming that this is the only relevant portion of the patch?
Oops, I should have checked that I didn't have any other outstanding patches in
that directory before diffing it - but feel free to review them too ;-)
Comment on attachment 109826 [details] [diff] [review]
Proposed patch

>-        clipboard.copyString(addresses);
>+        clipboard.copyString(unescape(addresses));

r=me on this change.  File another bug telling me what those other changes do,
and I'll try to review them.
Attachment #109826 - Flags: review?(dean_tessman) → review+
Attached patch Extract of patch (obsolete) — Splinter Review
Attachment #109826 - Attachment is obsolete: true
Comment on attachment 129603 [details] [diff] [review]
Extract of patch

Transferring r=
Attachment #129603 - Flags: superreview?(bz-vacation)
Attachment #129603 - Flags: review+
Comment on attachment 129603 [details] [diff] [review]
Extract of patch

This will unescape using the charset of the document whose window.unescape is
being called.  In this case, that's the XUL document, which is in UTF-8.  If
the page is not also in UTF-8, you get intl bugs.

You want to unescape using the right charset (probably by looking up the
window.unescape for the window the target document lives on, using the
lookupGetter stuff, and using that).
Attachment #129603 - Flags: superreview?(bz-vacation) → superreview-
Comment on attachment 129611 [details] [diff] [review]
Appropriated some code from tabbrowser.xml :-)

Pick one you think is more suitable and change the other :-)
Attachment #129611 - Flags: superreview?(bz-vacation)
Attachment #129611 - Flags: review?(bz-vacation)
Comment on attachment 129611 [details] [diff] [review]
Appropriated some code from tabbrowser.xml :-)

There we go. Thanks.  ;)

There is some code in contentAreaUtils.js that calls unescape that could use
fixing; could you file a bug on that?
Attachment #129611 - Flags: superreview?(bz-vacation)
Attachment #129611 - Flags: superreview+
Attachment #129611 - Flags: review?(dean_tessman)
Attachment #129611 - Flags: review?(bz-vacation)
Comment on attachment 129611 [details] [diff] [review]
Appropriated some code from tabbrowser.xml :-)

Sure, looks good.  It could probably be written a little differently to not
have a blank exception handler, but this way serves the purpose.
Attachment #129611 - Flags: review?(dean_tessman) → review+
Hmmm... that code that calls unescape... it does try to unescape twice,
once in UTF-8 (as you noticed) and once in a guessed character set...
Comment on attachment 129611 [details] [diff] [review]
Appropriated some code from tabbrowser.xml :-)

Useful patch to make Copy Email Address work on addresses with obfuscated or
international characters.
Attachment #129611 - Flags: approval1.5b?
Comment on attachment 129611 [details] [diff] [review]
Appropriated some code from tabbrowser.xml :-)

a=asa (on behalf of drivers) for checkin to Mozilla 1.5beta.
Attachment #129611 - Flags: approval1.5b? → approval1.5b+
Fix checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
*** Bug 189516 has been marked as a duplicate of this bug. ***
Same bug for Firebird: bug 215993
Attachment #109826 - Flags: superreview?(jag)
Product: Core → Mozilla Application Suite
Component: XP Apps: GUI Features → UI Design
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: