What should happen if the destination file exists?
Bug #1228254 reported by
Barry Warsaw
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-download-manager |
Fix Released
|
Critical
|
Manuel de la Peña | ||
ubuntu-download-manager (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Let's say I ask the download service to download to /tmp/foo.tgz and this succeeds.
Now I ask again for it to download to /tmp/foo.tgz. What should happen?
Currently, u-d-m appends the new downloaded data to the existing file, but that's definitely not right since the hashes will be broken.
A few options, but I'm not sure what's best:
1) Truncate the original file and overwrite it.
2) Throw a DBus exception (e.g. the moral equivalent of EEXIST)
3) Append a .1 to the file name.
I'm currently leaning toward #2.
Related branches
lp:~mandel/ubuntu-download-manager/throw-error-exists
- Diego Sarmentero (community): Approve
- PS Jenkins bot: Approve (continuous-integration)
-
Diff: 231 lines (+139/-10)6 files modifiedlibubuntudownloadmanager/group_download.cpp (+8/-9)
libubuntudownloadmanager/single_download.cpp (+16/-0)
ubuntu-download-manager-tests/test_download.cpp (+62/-1)
ubuntu-download-manager-tests/test_download.h (+5/-0)
ubuntu-download-manager-tests/test_group_download.cpp (+46/-0)
ubuntu-download-manager-tests/test_group_download.h (+2/-0)
Changed in ubuntu-download-manager: | |
status: | New → Triaged |
importance: | Undecided → Critical |
assignee: | nobody → Manuel de la Peña (mandel) |
Changed in ubuntu-download-manager: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I'm leaning to the following implementation:
If the local-path is provided and we are not a confined application:
2) Throw a DBus exception (e.g. the moral equivalent of EEXIST)
if not confined:
3) Append a .1 to the file name. (although I'm appending a uuid to make sure we do not have an extra loop)