Bug 451226

Summary: No thumbnail for EPUB3 files
Product: [Frameworks and Libraries] kio-extras Reporter: Michał Goliński <ecthelion>
Component: Thumbnails and previewsAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: hasezoey, kde, nicolas.fella
Priority: NOR    
Version: 21.12.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michał Goliński 2022-03-07 09:13:01 UTC
The thumbnailer for Epub 3.0 does not work properly. The file from IDPF (the spec creators) has no cover in Dolphin, even though one is in the file: https://github.com/IDPF/epub3-samples/releases/download/20170606/epub30-spec.epub

STEPS TO REPRODUCE
1. Put the file into Dolphin
2. Enable previews

OBSERVED RESULT

Generic file icon

EXPECTED RESULT

Cover from the EPUB file itself.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION

I have done some debugging using the code from https://github.com/KDE/kio-extras/blob/master/thumbnail/ebookcreator.cpp

It seems that coverHref is found properly here:

https://github.com/KDE/kio-extras/blob/20f476fabfc3f5c50e514c075cea429f62f59652/thumbnail/ebookcreator.cpp#L157

But then the break on the next line skips the assignment itemHrefs[id] = href (this is ok, as we have already found the proper cover file).

Nonetheless, in the end, it's the (now broken) itemHrefs map that is used as the source for final coverHref, not the coverHref variable that was meticulously found before:

https://github.com/KDE/kio-extras/blob/20f476fabfc3f5c50e514c075cea429f62f59652/thumbnail/ebookcreator.cpp#L203

I suppose that line 203 should rather read:

QByteArray encoded = coverHref.toUtf8();
Comment 1 Kai Uwe Broulik 2022-03-07 09:17:21 UTC
Thanks for your analysis, I believe it is correct, since coverHref is used for the cover it found but then not actually used in the codepath below because of the line you mentioned.

Would you be interested in submitting a merge request to fix this on https://invent.kde.org/network/kio-extras
Comment 2 Michał Goliński 2022-03-07 10:09:47 UTC
Gladly, but I have no idea where to start (e.g., how to get an account at invent.kde.org).
Comment 3 Nicolas Fella 2022-03-07 13:18:39 UTC
You can register at identity.kde.org
Comment 4 Albert Astals Cid 2022-03-07 14:08:44 UTC
Git commit 2c05bf836247effdcbfbb4ce13bee3571f4c3dd4 by Albert Astals Cid, on behalf of Michał Goliński.
Committed on 07/03/2022 at 14:08.
Pushed by aacid into branch 'master'.

Use proper cover href for EPUB 3.0

Rationale for change: see comments in  https://bugs.kde.org/show_bug.cgi?id=451226

M  +1    -1    thumbnail/ebookcreator.cpp

https://invent.kde.org/network/kio-extras/commit/2c05bf836247effdcbfbb4ce13bee3571f4c3dd4
Comment 5 hasezoey 2022-04-30 11:32:58 UTC
*** Bug 452411 has been marked as a duplicate of this bug. ***