Closed Bug 279035 Opened 20 years ago Closed 18 years ago

canonizeUrl() ignores appended directories

Categories

(Firefox :: Address Bar, enhancement)

x86
Windows XP
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 2 beta1

People

(Reporter: mgp, Assigned: pkasting)

References

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

The canonizeUrl() function in browser.js is responsible for automatically adding
the "http://" prefix and ".com", ".net", or ".org" suffixes to what is typed in
the Location bar, depending on what keyboard shortcut is used. This is useless,
however, when the user wishes to also enter some subdirectory or specify a
remote file for viewing (e.g., "google/scholar" + Ctrl + Enter should generate
"www.google.com/scholar" [subdirectory], and "google/images/logo.gif" + Ctrl +
Enter should generate "http://www.google.com/images/logo.gif").

Reproducible: Always

Steps to Reproduce:
1. Type in an domain name without its accompanying "http://www." prefix or
".com" suffix, followed by a slash and a directory name or file 
2. Hit CTRL + Enter

Actual Results:  
The resulting URL has its ".com" suffix appended after the directory name or
file, ont before

Expected Results:  
The resulting URL should have its ".com" suffix placed before the first slash
and the directory name or file
Attached patch fix to provide new functionality (obsolete) — Splinter Review
This is from a diff from the browser.js file in the Firefox 1.0 source
Comment on attachment 171801 [details] [diff] [review]
fix to provide new functionality

1872a1873
>       
1874c1875,1878
<	url = "http://www." + url + suffix;
---
>       var firstSlash = url.indexOf("/");
>       if (firstSlash < 0)
>         firstSlash = url.length;
>       url = "http://www." + url.substring(0, firstSlash) + suffix + url.substring(firstSlash, url.length);
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #171801 - Attachment is patch: true
Attachment #171801 - Flags: review?
for kicks, this should work:

url = url.replace(/(^[^\/]*)(|\/)/, "http://www.$1"+suffix+"$2");
Attachment #171801 - Flags: review? → review?(mconnor)
WORKAROUND: The Autocomplete Manager extension (https://addons.mozilla.org/extensions/moreinfo.php?id=2300) includes a bugfix for this.
Taking with hopes of updating the patch here.
Assignee: bugs → pkasting
Attached patch Updated patch (obsolete) — Splinter Review
I made one change to the original patch to prevent the suffix insertion from resulting in two slashes (which is a different URL).  This is a patch against the trunk.
Attachment #171801 - Attachment is obsolete: true
Attachment #221397 - Flags: review?(mconnor)
Attachment #171801 - Flags: review?(mconnor)
Nominating for Fx2 B1.  This is a small patch that makes our behavior a little less braindead.
Flags: blocking-firefox2?
Adding a target milestone to increase likelihood of search queries finding me
Target Milestone: --- → Firefox 2 beta1
Attachment #221397 - Flags: review?(mconnor)
Attachment #221397 - Flags: review+
Attachment #221397 - Flags: approval-branch-1.8.1+
Status: NEW → ASSIGNED
Flags: blocking-firefox2? → blocking-firefox2+
The curious part is that it built and ran just fine without these semicolons, but it seems poor form to omit them nonetheless.
Attachment #221397 - Attachment is obsolete: true
fixed-1.8-branch, fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
*** Bug 259707 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: