Closed Bug 683422 Opened 9 years ago Closed 9 years ago

An Ampersand (&) on the URL line breaks Translate Page

Categories

(SeaMonkey :: General, defect)

SeaMonkey 2.3 Branch
x86
Windows 7
defect
Not set

Tracking

(seamonkey2.3 wontfix, seamonkey2.4 fixed, seamonkey2.5 fixed, seamonkey2.6 fixed)

RESOLVED FIXED
Tracking Status
seamonkey2.3 --- wontfix
seamonkey2.4 --- fixed
seamonkey2.5 --- fixed
seamonkey2.6 --- fixed

People

(Reporter: therubex, Assigned: philip.chee)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110820 Firefox/6.0 SeaMonkey/2.3.1
Build ID: 20110820145925

Steps to reproduce:

 
URL: http://forums.mozillazine.org/viewtopic.php?f=3&t=2183189
Tools | Translate Page
 


Actual results:

 
The URL sent to Google Translate is truncated.
All characters after the ampersand are lost.
Google is not able to translate the page.
 


Expected results:

 
The entire URL should be passed to Google Translate.
Google should then translate the page for you.
 
 
It is quite common, for forums in particular, to use an (&) in their URL line.
Attempting to translate them from Tools | Translate breaks - often.

The same URLs manually pasted into http://translate.google.com/ work as the URL is not modified.

URL encoding the (&) would not appear to be a solution as it seems Google does not decode it back to what would be valid for a particular forum.

Don't know if there could be any security concerns in passing the full URL in plain text?
 

Some examples that break:

http://www.pcqanda.com/dc/dcboard.php?az=show_topic&forum=2&topic_id=535822&mesg_id=535822&page=

> http://www.pcqanda.com/dc/dcboard.php?az=show_topic

http://forums.mozillazine.org/viewtopic.php?f=3&t=2183189

> http://forums.mozillazine.org/viewtopic.php?f=3

http://forums.informaction.com/viewtopic.php?f=7&t=6997

> http://forums.informaction.com/viewtopic.php?f=7

http://www.digitalvolcano.co.uk/board/viewtopic.php?f=4&t=699

> http://www.digitalvolcano.co.uk/board/viewtopic.php?f=4
function Translate()
{
  var service = GetLocalizedStringPref("browser.translation.service");
  var serviceDomain = GetLocalizedStringPref("browser.translation.serviceDomain");
  var targetURI = getWebNavigation().currentURI.spec;

  // if we're already viewing a translated page, then just reload
  if (targetURI.indexOf(serviceDomain) >= 0)
    BrowserReload();
  else {
    loadURI(encodeURI(service + targetURI));
  }
}

The following works for me:
loadURI(encodeURI(service) + encodeURIComponent(targetURI));
Neil is this the correct fix?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → philip.chee
Status: NEW → ASSIGNED
Attachment #557493 - Flags: review?(iann_bugzilla)
Attachment #557493 - Flags: review?(iann_bugzilla) → review+
Comment on attachment 557493 [details] [diff] [review]
Patch v1.0 use encode

Simple one line fix.
Attachment #557493 - Flags: approval-comm-beta?
Attachment #557493 - Flags: approval-comm-aurora?
Attachment #557493 - Flags: approval-comm-beta?
Attachment #557493 - Flags: approval-comm-beta+
Attachment #557493 - Flags: approval-comm-aurora?
Attachment #557493 - Flags: approval-comm-aurora+
You need to log in before you can comment on or make changes to this bug.