Bug 377351 - QFileDialog::getSaveFileName() checks for existing files before appending the file name extension
Summary: QFileDialog::getSaveFileName() checks for existing files before appending the...
Status: ASSIGNED
Alias: None
Product: plasma-integration
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 5.9.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-07 19:15 UTC by Frank Schaefer
Modified: 2025-08-05 21:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Schaefer 2017-03-07 19:15:24 UTC
When using a QFileDialog::getSaveFileName with automatic file name suffix appending enabled, the overwrite check is done before appending the file name extension, which is wrong.
I have verified that QFileDialog calls the native KDE dialog (Qts own dialog also doesn't provide automatic file name suffix appending).

Steps to reproduce:
1.) create a file called "aaa" (e.g. in the applications path)
2.) open save dialog, e.g. QString fileName = QFileDialog::getSaveFileName(this, "Save", QCoreApplication::applicationDirPath(), "test files(*.zzz)");
3.) enable automatic file name extension appending in the dialog
4.) enter file name "aaa"
5.) confirm saving

=> dialog should return file name "aaa.zzz" (file doesn't exist)
=> instead the user is asked to confirm overwrite of file "aaa" (which already exists)
=> if overwriting is confirmed, file name "aaa" is returned instead of "aaa.zzz"
(if "aaa" didn't exist and the overwrite check passes, "aaa.zzz" is returned as expected)

Used Qt version is 5.7.1.
Comment 1 Nate Graham 2020-09-08 14:59:20 UTC
Can you still reproduce this with Plasma 5.19?
Comment 2 Frank Schaefer 2020-09-12 12:37:07 UTC
Yes.
Comment 3 Bug Janitor Service 2025-08-05 21:58:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1967