https://bugs.kde.org/show_bug.cgi?id=525449
Bug ID: 525449
Summary: Spectacle fails to save PNG screenshots when image/*
is returned by the MIME database
Classification: Applications
Product: Spectacle
Version First 6.7.4
Reported In:
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: General
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
Created attachment 195918
--> https://bugs.kde.org/attachment.cgi?id=195918&action=edit
~/.local/share/mime/packages/
DESCRIPTION
This issue is partially caused by another application, Brave Browser, which
creates a user-local MIME database entry under `~/.local/share/mime/packages/`.
This entry registers four wildcard MIME types:
audio/*
image/*
text/*
video/*
These wildcard registrations can interfere with MIME type detection for other
applications using the XDG MIME database.
Spectacle's `imageFileSuffix()` (`src/ExportManager.cpp:397`) uses
`QMimeDatabase::mimeTypeForUrl()` to resolve the file's MIME type and then
calls `preferredSuffix()` on the resulting MIME type.
With the affected MIME database, a `.png` file can be resolved as `image/*`,
whose preferred suffix is `apng`. Spectacle therefore ends up using `apng`
instead of the expected `png`.
I already registered a bug report with Brave Browser about this.
STEPS TO REPRODUCE
1. Have Brave Browser installed and running on Fedora Linux.
2. Allow Brave to create its user-local MIME database entry under
`~/.local/share/mime/packages`.
3. Run `update-mime-database ~/.local/share/mime`.
4. Open Spectacle and save a screenshot as a PNG image.
OBSERVED RESULT
Spectacle resolves the `.png` screenshot as `image/*`, whose preferred suffix
is `apng`. It then attempts to write the screenshot using the `apng` format,
which results in:
```
QImageWriter cannot write image: Unsupported image format
Cannot save screenshot. Error while writing file.
```
The MIME type can be verified with:
`xdg-mime query filetype /path/to/example.png` -> `image/*`
EXPECTED RESULT
Spectacle should save the screenshot as a PNG file (`.png`) successfully,
regardless of unexpected wildcard MIME registrations in the user's local MIME
database.
The MIME type should also resolve to: `image/png`
SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 44
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.2
Kernel Version: 7.1.13-200.fc44.x86_64 (64-bit)
Graphics Platform: Wayland
--
You are receiving this mail because:
You are watching all bug changes.