Merge lp:~mandel/ubuntu-download-manager/install-correct-path into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Merged at revision: 249
Proposed branch: lp:~mandel/ubuntu-download-manager/install-correct-path
Merge into: lp:ubuntu-download-manager
Diff against target: 32 lines (+12/-0)
2 files modified
ubuntu-download-manager-priv/downloads/file_download.cpp (+10/-0)
ubuntu-download-manager-tests/downloads/test_download.cpp (+2/-0)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/install-correct-path
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu One hackers Pending
Review via email: mp+208936@code.launchpad.net

Commit message

This fix ensures that the temp file is renamed to the final file before the post-command is executed.

Description of the change

This fix ensures that the temp file is renamed to the final file before the post-command is executed. Please do follow the full test plan of udm (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-download-manager) with special care related to the click scope tests. If you can please follow the test plan for the click scope too (https://wiki.ubuntu.com/Process/Merges/TestPlan/unity-scope-click)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-download-manager-priv/downloads/file_download.cpp'
2--- ubuntu-download-manager-priv/downloads/file_download.cpp 2014-02-22 10:41:59 +0000
3+++ ubuntu-download-manager-priv/downloads/file_download.cpp 2014-03-01 15:50:30 +0000
4@@ -389,6 +389,16 @@
5 } else {
6 // first item of the string list is the command
7 // the rest is the arguments
8+ DOWN_LOG(INFO) << "Renaming '" << _tempFilePath << "'"
9+ << "' to '" << _filePath << "'";
10+
11+ auto fileMan = FileManager::instance();
12+ if (fileMan->exists(_tempFilePath)) {
13+ LOG(INFO) << "Renaming: '" << _tempFilePath << "' to '"
14+ << _filePath << "'";
15+ fileMan->rename(_tempFilePath, _filePath);
16+ }
17+
18 QString command = commandData.at(0);
19 commandData.removeAt(0);
20 QStringList args;
21
22=== modified file 'ubuntu-download-manager-tests/downloads/test_download.cpp'
23--- ubuntu-download-manager-tests/downloads/test_download.cpp 2014-02-19 19:01:37 +0000
24+++ ubuntu-download-manager-tests/downloads/test_download.cpp 2014-03-01 15:50:30 +0000
25@@ -1459,6 +1459,8 @@
26 QStringList processArgs = listWrapper->value();
27 QCOMPARE(processCommand, command);
28 QVERIFY(processArgs.contains(download->filePath()));
29+ QVERIFY(QFile::exists(download->filePath()));
30+ QVERIFY(!QFile::exists(download->filePath() + ".tmp"));
31 QCOMPARE(processingSpy.count(), 1);
32 }
33

Subscribers

People subscribed via source and target branches