| Summary: | Renaming multiple files removes file extension for unknown file types | ||
|---|---|---|---|
| Product: | [Applications] dolphin | Reporter: | Tarulia <mihawk.90+kdebugs> |
| Component: | general | Assignee: | Dolphin Bug Assignee <dolphin-bugs-null> |
| Status: | ASSIGNED --- | ||
| Severity: | normal | CC: | dolphin-bugs-null, justin, meven, xushitong |
| Priority: | NOR | ||
| Version First Reported In: | 24.08.0 | ||
| Target Milestone: | --- | ||
| Platform: | Fedora RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Tarulia
2024-09-04 19:42:01 UTC
Confirmed with Dolphin 24.12.1 on: Operating System: Solus 4.7 KDE Plasma Version: 6.2.5 KDE Frameworks Version: 6.10.0 Qt Version: 6.8.1 Kernel Version: 6.12.9-312.current (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 PRO 4750U with Radeon Graphics Memory: 29.1 GiB of RAM Graphics Processor: AMD Radeon Graphics rename files which have same suffix `.idx` also makes file lost it's suffix.
seems like the `.idx` cannot be correctly batch renamed.
seems like a Qt bug, or the mime database doesn't contains the `.idx` suffix.
tested with minimal qt demo:
#include <QCoreApplication>
#include <QMimeData>
#include <QMimeDatabase>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QMimeDatabase db;
const QString extension = db.suffixForFileName("/home/debian/Downloads/file.idx");
qDebug() << "###### " << extension; // output an empty string
return 0;
}
also, this is not a bug of qt, qt reads all mime from system, the idx is not included in, see: debian@debian /usr/share/mime/text cat x-mpsub.xml ✔ 959 16:53:10 <?xml version="1.0" encoding="utf-8"?> <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="text/x-mpsub"> <!--Created automatically by update-mime-database. DO NOT EDIT!--> <comment>MPlayer subtitles</comment> <comment xml:lang="uk">субтитри MPlayer</comment> <comment xml:lang="sv">MPlayer-undertexter</comment> <comment xml:lang="ru">Субтитры MPlayer</comment> <comment xml:lang="pl">Napisy MPlayer</comment> <comment xml:lang="es">subtítulos de MPlayer</comment> <comment xml:lang="de">MPlayer-Untertitel</comment> <sub-class-of type="text/plain"/> <glob pattern="*.sub"/> </mime-type> so you can install the mimetype description file or create a file yourself to solve this issue. (In reply to xust from comment #3) > also, this is not a bug of qt, qt reads all mime from system, the idx is not > included in, see: > > debian@debian /usr/share/mime/text cat x-mpsub.xml > ✔ 959 16:53:10 > <?xml version="1.0" encoding="utf-8"?> > <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" > type="text/x-mpsub"> > <!--Created automatically by update-mime-database. DO NOT EDIT!--> > <comment>MPlayer subtitles</comment> > <comment xml:lang="uk">субтитри MPlayer</comment> > <comment xml:lang="sv">MPlayer-undertexter</comment> > <comment xml:lang="ru">Субтитры MPlayer</comment> > <comment xml:lang="pl">Napisy MPlayer</comment> > <comment xml:lang="es">subtítulos de MPlayer</comment> > <comment xml:lang="de">MPlayer-Untertitel</comment> > <sub-class-of type="text/plain"/> > <glob pattern="*.sub"/> > </mime-type> > > so you can install the mimetype description file or create a file yourself > to solve this issue. but I think kio could do some workaround? such as if suffix obtained from qmimedatabase is empty, do split by dot, and use the last part as suffix? only if `fullName.split('.').count() >=2` Well that raises 2 questions: 1. Should this rely on MIME-types at all or simply see everything after the last dot as the file-extension (possibly with a switch?) 2. What's the upstream of those MIME-type files so the extension can be added there? Is it https://gitlab.freedesktop.org/xdg/shared-mime-info/-/releases ? (In reply to Tarulia from comment #5) > Well that raises 2 questions: > > 1. Should this rely on MIME-types at all or simply see everything after the > last dot as the file-extension (possibly with a switch?) > 2. What's the upstream of those MIME-type files so the extension can be > added there? Is it > https://gitlab.freedesktop.org/xdg/shared-mime-info/-/releases ? 1. I have the same idea with you, as I suggeted to KIO in my comments, and I'll make a pr see if KIO accept. 2. I'm not clear about this. A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1846 (In reply to xust from comment #2) > rename files which have same suffix `.idx` also makes file lost it's suffix. > seems like the `.idx` cannot be correctly batch renamed. > seems like a Qt bug, or the mime database doesn't contains the `.idx` suffix. Qt and KDE software use standard shared mime database https://gitlab.freedesktop.org/xdg/shared-mime-info If an extension needs to be recoginsed, that's where it needs to be fixed. |