Bug 394318 - Replacing a file without confirmation
Summary: Replacing a file without confirmation
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.46.0
Platform: Archlinux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
Keywords: usability
Depends on:
Reported: 2018-05-16 10:30 UTC by Evgenii
Modified: 2018-06-01 21:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.47


Note You need to log in before you can comment on or make changes to this bug.
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

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