Solve a bug which can happen with multiple files with the same name
ClosedPublic

Authored by bdevries on Nov 8 2019, 9:44 PM.

Details

Summary

In case there are two or more files with the same name in the source
(e.g. in separate subfolders), and if an identical file with that
name also exists in the destination, then a dialog will pop up asking
for user intervention (overwrite, ignore, cancel).

The reason is the following:

  • File1 will get copied into the temporary import folder. In case an identical file with that name already exists in the destination, this file will be skipped. I.e. the file will not be moved, and stays in the temporary folder.
  • File2 (with identical name) gets copied into the temporary folder. However, a file with that name will already exist, so a dialog box will pop up to ask for user input.

Since this can only happen if file1 has been skipped (otherwise
it would have been moved out of the temporary folder), file2 should
always overwrite file1. Otherwise, if file1 and file2 share the
same name but are not identical, unexpected things might happen and
data might be lost.

Test Plan

Tested with the situation described above: multiple files with the
same name in the source and destination folders, with or without
identical contents.
With this patch, no dialog box pops up, and the correct import
action is done.

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bdevries created this revision.Nov 8 2019, 9:44 PM
Restricted Application added a project: Gwenview. · View Herald TranscriptNov 8 2019, 9:44 PM
bdevries requested review of this revision.Nov 8 2019, 9:44 PM
ngraham accepted this revision.Dec 3 2019, 6:26 PM
ngraham added a subscriber: ngraham.

Yep, makes sense, thanks!

This revision is now accepted and ready to land.Dec 3 2019, 6:26 PM
ngraham retitled this revision from Solve a bug which can happen with multiple files with the same name. to Solve a bug which can happen with multiple files with the same name.Dec 3 2019, 6:33 PM
This revision was automatically updated to reflect the committed changes.