targetFile.path is not updated when the target file already exists

VERIFIED DUPLICATE of bug 301328

Status

()

Toolkit
Downloads API
VERIFIED DUPLICATE of bug 301328
9 years ago
9 years ago

People

(Reporter: fnevgeny, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6

I'm writing an extension that monitors downloaded files. So I register an nsIDownloadProgressListener in which onDownloadStateChange(aState, aDownload) in case of aDownload.state == 1 should give me the target path via aDownload.targetFile.path. Correct? This indeed works most of the time, except when user downloads the same file more than once. In such a case FF would silently use /tmp/filename-1.ext, /tmp/filename-2.ext etc instead of /tmp/filename.ext, however aDownload.targetFile.path still says /tmp/filename.ext.

NB: of course, this concerns only "silent" downloads (i.e., when FF downloads a file for opening it in an application and picks a target path automatically). "Save link as" is fine.

Reproducible: Always
(Reporter)

Updated

9 years ago
Version: unspecified → 3.0 Branch
Component: Extension Compatibility → Download Manager
Product: Firefox → Toolkit
QA Contact: extension.compatibility → download.manager
Version: 3.0 Branch → unspecified

Comment 1

9 years ago
I can confirm this problem on Windows xp

When using "Open with", files are saved to the temp directory.  If a file with that name already exists, the download manager correctly increments the filename, but does not put this new filename in the downloads.sqlite database.

This is a problem because if you try to open the second file from the download manager, it will open the first instead.

Comment 2

9 years ago
Created attachment 384273 [details]
Screenshot of the problem

Here I have downloaded "fw4.pdf" using "open with"
The second time, the file gets saved in windows as "fw4-1.pdf" (on the right)

You can see in the raw data from downloads.sqlite (bottom) that the file name and local location did not get the incremented "fw4-1.pdf" name

Updated

9 years ago
Duplicate of this bug: 499465

Updated

9 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 301328

Updated

9 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.