piroor / multipletab

Multiple Tab Handler, Provides feature to close multiple tabs.
http://piro.sakura.ne.jp/xul/multipletab/
Other
81 stars 23 forks source link

Multiple files with same name with "Save Tabs as Files" #214

Closed tobbez closed 4 years ago

tobbez commented 6 years ago

Short description

In some cases, when using the 'Save Tabs as Files' feature on multiple tabs that contain files with the same base name, MTH will try to download them to the same local path.

Steps to reproduce

  1. Start Firefox with clean profile.
  2. Install MTH.
  3. Open two tabs with URLs that have the same base name, for example example.com/directory1/file.jpg and example.com/directory2/file.jpg.
  4. Make sure your Saved Tabs directory doesn't already have a file with the same name (file.jpg in the example).
    1. Select both the tabs using MTH and invoke the 'Save Tabs as Files' action.

Expected result

MTH attempts to download both files into the same local path (file.jpg in the example).

Actual result

MTH should download the files into separate paths (file.jpg and file(1).jpg in the example).

Note that the problem does not seem to occur if a file of the same name already exists before you invoke the action (in that case, the files correctly get (1), (2), ... added to the file names).

Environment

tobbez commented 6 years ago

After looking a bit at it, there doesn't seem to be much code in MTH concering downloads (basically just a call to browser.downloads.download), so maybe this is a bug in Firefox?

Even if that is the case though, it might be mitigated by waiting until the promise returned by browser.downloads.download) resolves before calling browser.downloads.download for the next file.

piroor commented 6 years ago

Thanks. By the commit 82cc1e4 now downloaded files will have unique name.