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

RESOLVED FIXED

Status

SeaMonkey
General
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: therube, Assigned: Philip Chee)

Tracking

SeaMonkey 2.3 Branch
x86
Windows 7

SeaMonkey Tracking Flags

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

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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
(Reporter)

Comment 1

6 years ago
Actually it /appears/ to start out well, but in reality at the first GET the Query String has already been truncated.
 
 
00:00:05.933	0.213	741	663	GET	200	text/html	http://translate.google.com/translate?prev=/language_tools&u=http://forums.mozillazine.org/viewtopic.php?f=3&t=2183189
00:00:06.188	0.153	866	2298	GET	200	text/html	http://translate.google.com/translate_n?prev=/language_tools&u=http://forums.mozillazine.org/viewtopic.php%3Ff%3D3
00:00:06.223	0.151	905	623	GET	200	text/html	http://translate.google.com/translate_p?prev=/language_tools&u=http://forums.mozillazine.org/viewtopic.php%3Ff%3D3&usg=ALkJrhh4jDayGH1J4kj0mT50Bu9FTK4KaQ
00:00:06.747	0.073	602	0	GET	(Aborted)	NS_BINDING_ABORTED	http://translate.googleusercontent.com/translate_c?prev=/language_tools&rurl=translate.google.com&u=http://forums.mozillazine.org/viewtopic.php%3Ff%3D3&usg=ALkJrhg2CLySXVGgBYpqLJmmg5eLm0QiJg
00:00:06.867	0.040	766	0	GET	(Error)	NS_ERROR_ABORT	http://translate.googleusercontent.com/translate_c?prev=/language_tools&rurl=translate.google.com&u=http://forums.mozillazine.org/viewtopic.php%3Ff%3D3&usg=ALkJrhg2CLySXVGgBYpqLJmmg5eLm0QiJg
(Assignee)

Comment 2

6 years ago
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)

Updated

6 years ago
status-seamonkey2.3: --- → affected
status-seamonkey2.4: --- → affected
status-seamonkey2.5: --- → affected
status-seamonkey2.6: --- → affected
(Assignee)

Comment 3

6 years ago
Created attachment 557493 [details] [diff] [review]
Patch v1.0 use encode
Assignee: nobody → philip.chee
Status: NEW → ASSIGNED
Attachment #557493 - Flags: review?(iann_bugzilla)

Updated

6 years ago
Attachment #557493 - Flags: review?(iann_bugzilla) → review+
(Assignee)

Comment 4

6 years ago
Pushed.
http://hg.mozilla.org/comm-central/rev/1a07f47df164
(Assignee)

Comment 5

6 years ago
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?

Updated

6 years ago
Attachment #557493 - Flags: approval-comm-beta?
Attachment #557493 - Flags: approval-comm-beta+
Attachment #557493 - Flags: approval-comm-aurora?
Attachment #557493 - Flags: approval-comm-aurora+
(Assignee)

Comment 6

6 years ago
Pushed:
http://hg.mozilla.org/releases/comm-aurora/rev/27805def8a85
http://hg.mozilla.org/releases/comm-beta/rev/54f2d228378e
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
status-seamonkey2.3: affected → wontfix
status-seamonkey2.4: affected → fixed
status-seamonkey2.5: affected → fixed
status-seamonkey2.6: affected → fixed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.