Bug 501085

Summary: Extra dot added to the file name when saving a file using the "Save As" dialog
Product: [Frameworks and Libraries] frameworks-kio Reporter: Huanyu Liu <1293660441>
Component: Open/save dialogsAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 5.116.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Huanyu Liu 2025-03-05 07:25:49 UTC
SUMMARY
When saving a file using the "Save As" dialog, an extra dot is added to the file name. This bug no longer happens when "Automatically select filename extension" is unticked, but this option is ticked by default after all.

STEPS TO REPRODUCE
1. Launch Okteta
2. Create a new file
3. Click on "Save As", make sure "Automatically select filename extension" is ticked (default behavior)
4. Input an arbitrary file name (e.g. "test.bin") and click on "Save"

OBSERVED RESULT
The name of the saved file becomes "test.bin."

EXPECTED RESULT
The name of the saved file should be "test.bin"

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.5-arch1-1 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
For a hex editor, I don't think it makes sense to "Automatically select filename extension", so maybe this option could be removed.
Comment 1 Friedrich W. H. Kossebau 2025-03-05 17:27:25 UTC
Thanks for the report, can confirm.

Seems to be a regression from https://phabricator.kde.org/D10114 in KIO, also still happens with KF6 version,

Guess Okteta being the only victim of this logic, I have to bite and see to fix that :( Will have a look to get this sorted out soonish.
Comment 2 Bug Janitor Service 2025-03-05 18:42:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1827
Comment 3 Bug Janitor Service 2025-03-05 20:21:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1828
Comment 4 Bug Janitor Service 2025-03-07 13:51:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1829
Comment 5 Bug Janitor Service 2025-03-07 14:15:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1830
Comment 6 Friedrich W. H. Kossebau 2025-03-14 21:41:12 UTC
Git commit a7be926869d82d70de549970c25ee76a88a2e6a9 by Friedrich W. H. Kossebau.
Committed on 14/03/2025 at 21:19.
Pushed by kossebau into branch 'master'.

KFileWidget: drop broken workaround for old s-m-i octet-stream file suffix

Old logic was establishing m_extension to be '.' and thus screwing over
the edited filename when "application/octet-stream" is the set filter,
KFileWidget: drop broken workaround for old s-m-i octet-stream file suffix

Logic was establishing m_extension to be '.' when
"application/octet-stream" is the set filter and currentExtension being
empty, thus screwing over the edited filename.

s-m-i 1.10 and Qt 5.11.0 got the octet-stream file suffix fixed,
and with KCoreAddons 6.13 now also requiring at least s-m-i 2.1,
the work-around can be dropped.

M  +5    -0    autotests/kfilewidgettest.cpp
M  +1    -2    src/filewidgets/kfilewidget.cpp

https://invent.kde.org/frameworks/kio/-/commit/a7be926869d82d70de549970c25ee76a88a2e6a9
Comment 7 Friedrich W. H. Kossebau 2025-03-14 21:49:17 UTC
Git commit 053420fb34fb1d1a3632aa3386d45b931036834d by Friedrich W. H. Kossebau.
Committed on 14/03/2025 at 21:20.
Pushed by kossebau into branch 'kf5'.

KFileWidget: drop broken workaround for old s-m-i octet-stream file suffix

Logic was establishing m_extension to be '.' when
"application/octet-stream" is the set filter and currentExtension being
empty, thus screwing over the edited filename.

s-m-i 1.10 and Qt 5.11.0 got the octet-stream file suffix fixed,
and with KCoreAddons 5.117.0 now also requiring at least s-m-i 1.10,
the work-around can be dropped.

M  +5    -0    autotests/kfilewidgettest.cpp
M  +1    -2    src/filewidgets/kfilewidget.cpp

https://invent.kde.org/frameworks/kio/-/commit/053420fb34fb1d1a3632aa3386d45b931036834d