Non-unique names get ($number) added before the first dot instead of the last one

Bug #1298346 reported by Michał Sawicz
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-download-manager (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

$ ls .local/share/ubuntu-download-manager/Downloads/
com.ubuntu.developer.mzanetti.xbmcremote_1.4.1.0_armhf.click
com (1).ubuntu.developer.mzanetti.xbmcremote_1.4.1.0_armhf.click
com (2).ubuntu.developer.mzanetti.xbmcremote_1.4.1.0_armhf.click

Feels like those should be added at the end instead.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: ubuntu-download-manager 0.3+14.04.20140321-0ubuntu1
Uname: Linux 3.4.0-5-mako armv7l
ApportVersion: 2.13.3-0ubuntu1
Architecture: armhf
Date: Thu Mar 27 12:23:09 2014
InstallationDate: Installed on 2014-03-26 (1 days ago)
InstallationMedia: Ubuntu Trusty Tahr (development branch) - armhf (20140326)
SourcePackage: ubuntu-download-manager
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Michał Sawicz (saviq) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-download-manager (Ubuntu):
status: New → Confirmed
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

The problem is in `FileNameMutex::lockFileName()` which uses fileInfo.completeSuffix()[0] to understand where put the number, which returns all letters that are at right of the first dot.

Now, this makes sense, because we do not want to break the file (so we do not want to append the number) but at the same time we don't want just to insert the number at the left of the last dot, because there are extensions with two dots (as .tar.gz)

We should check if we know the type of the file and add the number between the filename and the extension (Chromium does that, it creates something like "file (1).extension", otherwise do something else (left of the last dot?).

I think we need to investigate how other download managers take care of this.

https://doc.qt.io/qt-5/qfileinfo.html#completeSuffix

Revision history for this message
Giuseppe Giacalone (giacabass) wrote :

Downloading on a BQ Aquaris Ubuntu Touch the OpenStore_0.96_armhf.click file from this site (https://open.uappexplorer.com/docs#install), and downloading it a second time, the file in the Downloads folder is called OpenStore_0.1.96_armhf.click

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.