Closed Bug 306168 Opened 19 years ago Closed 19 years ago

When downloading multiple files with the same names, the extra number goes before the wrong dot

Categories

(Toolkit :: Downloads API, defect)

1.7 Branch
x86
Windows XP
defect
Not set
trivial

Tracking

()

VERIFIED DUPLICATE of bug 231048

People

(Reporter: GPHemsley, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

If you try to download a file that has the same name as another file, Mozilla
quietly appends a number (such as "-1") to the file name, before the file
extension. For example, setup.exe will become setup-1.exe.

However, if the filename has more than one dot, the number will be put in the
wrong place. For example, setup_1.0.exe will become setup_1-1.0.exe, instead of
setup_1.0-1.exe.

Reproducible: Always

Steps to Reproduce:
1. Download a file with more than one dot in the filename to whichever directory
you choose (use whatever you've set in Firefox).
2. Download the same file to the same directory (don't change any settings in
between).
3. Note that the helpful little unique identifier number is in the wrong place.

Actual Results:  
The number goes before the first dot.

Expected Results:  
The number should go before the last dot (or, rather, before the file extension,
if there is one).
Version: unspecified → 1.0 Branch
It seems to have to do with this:
http://lxr.mozilla.org/aviary101branch/source/browser/base/content/contentAreaUtils.js#448

It should probably be:
        file.leafName = file.leafName.replace(/((\d+)\.\w*$)|((\d+)$)/,

(Incidentally, I can't seem to find the
browser/components/downloads/content/nsHelperAppDlg.js that's referred to in the
comments above that. Did I just not look hard enough?)
Fixed in trunk.

*** This bug has been marked as a duplicate of 231048 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.