• Bart De Vries's avatar
    Solve a bug which can happen with multiple files with the same name · d3acacad
    Bart De Vries authored
    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.
    
    Reviewers: #gwenview, ngraham
    
    Reviewed By: #gwenview, ngraham
    
    Subscribers: ngraham
    
    Tags: #gwenview
    
    Differential Revision: https://phabricator.kde.org/D25224
    d3acacad
importer.cpp 7.36 KB