Bug 491712 - Text file with extension other than .txt has an empty icon unless you put content in it.
Summary: Text file with extension other than .txt has an empty icon unless you put con...
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.4.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-14 12:24 UTC by kocelfc
Modified: 2024-08-14 17:07 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kocelfc 2024-08-14 12:24:42 UTC
If you try to create a text file with an extension other than .txt by using Create New > Text file, the file that gets created has an empty icon and appears as "Empty document" in the properties of the file until you open it, and edit it to put something in it with Kate for example.

I tested a Live ISO with Fedora 40 KDE which has KDE Plasma 6.0.3 and Dolphin 24.02.1 and the file is created with an icon, and in properties it appears as "Plain text document".

STEPS TO REPRODUCE
1. Create a new text file with an extension different than .txt (for example .cfg or .conf)
2. Notice that the icon is empty and it's listed as "Empty document" in properties
3. Edit the file with Kate and put something in it.
4. The file has an icon now and it appears as "Plain text document"

OBSERVED RESULT

File is created with no icon

EXPECTED RESULT

File has an icon

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.6.45-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 30.4 GiB of RAM
Graphics Processor: AMD Radeon RX 6800
Comment 1 kocelfc 2024-08-14 16:38:06 UTC
Doesn't appear to be a Dolphin bug. It started somewhere between kio versions 6.3.0 and 6.4.0.
Comment 2 kocelfc 2024-08-14 16:57:34 UTC
Bisect led to 

commit 3b5a569733511ba6d4fe3896d9891390e928d535 (HEAD)
Author: Nate Graham <nate@kde.org>
Date:   Sun Jun 30 09:48:47 2024 -0600

    Remove unnecessary space character in empty text file template
    
    BUG: 487768
    FIXED-IN: 6.4

 src/new_file_templates/TextFile.txt | 1 -
 1 file changed, 1 deletion(-)

https://invent.kde.org/frameworks/kio/-/commit/3b5a569733511ba6d4fe3896d9891390e928d535
Comment 3 fanzhuyifan 2024-08-14 17:07:41 UTC
If you run `xdg-mime query filetype a.cfg` on an empty a.cfg, it will return "application/x-zerosize". This is because .cfg extensions are not present in the mime types database. So dolphin using an empty icon and saying its file type is empty document is intentional behavior.