Bug 456091 - Creating new text file forcefully changes extension
Summary: Creating new text file forcefully changes extension
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.95.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-28 16:53 UTC by David
Modified: 2022-07-01 14:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.96


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David 2022-06-28 16:53:38 UTC
SUMMARY
If I try to generate a blank text file through the dolphin menu and change the extension to something like "mp3", it will forcibly add a .txt extension to the file.

STEPS TO REPRODUCE
1. Launch dolphin.
2. Right-click into some folder, select 'Create New' -> 'Text File...'.
3. Name the new file as "file.mp3" and click Ok.

OBSERVED RESULT
Creates a file named "file.mp3.txt".

EXPECTED RESULT
Should create a file named "file.mp3".

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.18.0-2-amd64 (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 2700 Eight-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD VEGA10
Comment 1 Nate Graham 2022-06-29 15:52:00 UTC
mp3 isn't a valid extension for a text file. Why would you want to do this?

If you want to create a new empty file with a filename extension of your choice, you should use Create New > Empty File. Does that work for your use case?
Comment 2 David 2022-06-29 16:15:40 UTC
(In reply to Nate Graham from comment #1)
> mp3 isn't a valid extension for a text file. Why would you want to do this?
> 
> If you want to create a new empty file with a filename extension of your
> choice, you should use Create New > Empty File. Does that work for your use
> case?

There's no such option in the right-click menu. Also, if the file is empty, it wouldn't make a difference that it isn't a text file.
Comment 3 Nate Graham 2022-06-29 16:43:37 UTC
Oh, maybe it's a local patch added by Fedora.

Either way, can reproduce. The fact that you want to do this seems odd to me, but being prevented from doing so is definitely a bug. :)
Comment 4 Bug Janitor Service 2022-06-29 18:29:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/884
Comment 5 Nicolas Fella 2022-06-30 14:08:07 UTC
Git commit ebe6706ccad4bd94d767dff4ebd4fde4c73cb31c by Nicolas Fella.
Committed on 30/06/2022 at 12:51.
Pushed by nicolasfella into branch 'master'.

[knewfilemenu] Don't forcibly change file extension

The code tries to 'fix' file extensions, but that may not be what the user wants

They expect the extension they typed to be used

This mechanism was originally introduced to fix cases where desktop files without .desktop extensions where misdetected as other files, but that is better fixed by always setting the .desktop extension

M  +0    -17   src/filewidgets/knewfilemenu.cpp

https://invent.kde.org/frameworks/kio/commit/ebe6706ccad4bd94d767dff4ebd4fde4c73cb31c