Bug 394318

Summary: Replacing a file without confirmation
Product: frameworks-kio Reporter: Evgenii <forsimen>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: elvis.angelaccio, kdelibs-bugs, nate
Priority: NOR Keywords: usability
Version: 5.46.0   
Target Milestone: ---   
Platform: Archlinux Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.47

Description Evgenii 2018-05-16 10:30:40 UTC
While pasting an image from clipboard and giving a name to the file that is going to be created the same as one of the existing files, the existing file is replaced without confirmation.
Comment 1 Elvis Angelaccio 2018-06-01 21:39:27 UTC
Git commit b73355da3f5b963b67c1888a21384074c0e93e22 by Elvis Angelaccio.
Committed on 01/06/2018 at 21:35.
Pushed by elvisangelaccio into branch 'master'.

Check if destination exists also when pasting binary data

Summary:
Currently we check whether the destination URL exists only if we are
pasting text (or if the mimedata has only one format).

If we are pasting e.g. images copied from Spectacle, we unconditionally
overwrite the destination URL.

This patch moves the StatJob+RenameDialog from `getNewFileName()` to a
new `getDestinationUrl()` function, which we can also call from `chooseFormatAndUrl()`.
FIXED-IN: 5.47

Test Plan:
- Paste some image into an existing file and check the rename dialog.
- Check that pasting text still shows the rename dialog.

Reviewers: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13145

M  +30   -22   src/widgets/paste.cpp

https://commits.kde.org/kio/b73355da3f5b963b67c1888a21384074c0e93e22