Displaying EPUBs in QuickView mode. No plugin issue!!!

Please report only one bug per message!

Moderators: Stefan2, white, sheep, Hacker

Post Reply
User avatar
elgonzo
Senior Member
Senior Member
Posts: 377
Joined: 2013-09-04, 14:07 UTC

Displaying EPUBs in QuickView mode. No plugin issue!!!

Post by *elgonzo » 2016-06-03, 21:18 UTC

UPDATE: I have been informed (here) that the issue is already known and should be addressed in TC9. :)


There have been several discussions with regard to displaying epubs in QuickView mode (Ctrl+Q) using some lister plug-in capable of displaying epubs.

It has been established that epubs containing Calibre bookmarks will not be displayed in QuickView, and it has been suspected that this is the fault of the involved lister plug-ins.

Today i found out that this is not a problem of a plug-in, but a problem caused by TC.


So, what happens and how does it lead to the observed problem?

When invoking Quick View, TC checks if the file is a ZIP archive. If so, it looks for a file inside that ZIP archive which matches the META-INF/*.txt pattern (coincidentally, the Calibre bookmark file matches).

If such a file is not found, TC will pass control to a plug-in which is associated with the file extension of the quick-viewed file (or, if no appropriate plug-in exists, Quick View will simply show the binary content of the file to be quickviewed). So far so good...

However, if inside the ZIP archive a matching text file (META-INF/*.txt) is found, TC will just show the content of this text file in the QuickView pane, and that's it. As it seems, no plug-in will ever be invoked for Quick View when TC finds such a text file inside a ZIP archive.

I don't know what the reasons are behind this behavior of TC, but it effectively breaks Quick View for files which are using ZIP format and contain a META-INF/*.txt file (such as epubs with Calibre bookmarks, for example).


How to reproduce the problem:

The problem can be quickly reproduced and demonstrated. It is not necessary to have any plug-in to be installed; a clean TC installation is sufficient to reproduce the issue.

1.1. First, let's create a good ZIP file (good.zip).
1.2. Fill good.zip with a few files (shouldn't matter what files you choose).
1.3. Create a META-INF directory inside good.zip, and fill it with some files. Make sure, that the META-INF directory does NOT contain any file with a .txt extension.

2.1. Now let's make a bad ZIP file (bad.zip).
2.2. Make a copy of good.zip and name it bad.zip.
2.3. Add a *.txt file to the META-INF directory in bad.zip. File name does not matter, only the file extension .txt matters.

3. Quick view the good file good.zip. Notice that the Quick View panel shows the (binary) file data of the ZIP file.

4. Quick view bad.zip. Notice that the Quick View displays the content of the text file you placed in the META-INF directory.
Windows 7 Pro x64 SP1

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36554
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2016-06-06, 09:22 UTC

In TC9, you will have the option to set
QuickViewUnzipReadMe=0

to not show readme or other text files from within ZIP files.
Author of Total Commander
http://www.ghisler.com

User avatar
fenix_productions
Power Member
Power Member
Posts: 1952
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions » 2016-06-06, 11:12 UTC

ghisler(Author) wrote:In TC9, you will have the option to set
QuickViewUnzipReadMe=0

to not show readme or other text files from within ZIP files.
Would it be possible to also have:
QuickViewUnzipReadMe=-1
to show readme or other text files from within ZIP files *after* plugin check?

It would be nicer to have such fallback if plugins are not able to handle specific files types.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099

User avatar
elgonzo
Senior Member
Senior Member
Posts: 377
Joined: 2013-09-04, 14:07 UTC

Post by *elgonzo » 2016-06-06, 11:58 UTC

fenix_productions wrote:Would it be possible to also have:
QuickViewUnzipReadMe=-1
to show readme or other text files from within ZIP files *after* plugin check?

It would be nicer to have such fallback if plugins are not able to handle specific files types.
Very good idea!

Also, i noticed that the QuickView of text files embedded in ZIP archives is really confusing. Sometimes works and sometimes does not work as intended (which also explains why i mistakenly believed that this behavior only applies to text files inside a META-INF directory).

Essentially, it will show the first readme.txt that is smaller than 64KB (perhaps including some other common names for text files as well, idk).
If no such readme.txt exist, it will show the first *.txt file in a ZIP archive which is smaller than 64KB.
If all of the text files in the ZIP archive are larger than 64K, TC will actually hand over the file to a lister plug-in (assuming there is a matching plug-in), like as if there were no text files in the ZIP archive.

Which leads to this strange situation where the behavior of TC is not only dependent on the presence of text files in a ZIP archive but also on the size of those text files. :roll:

I think it would be a good idea to lift this artificial 64K limitation someday. It will make this feature work consistently across the board. (Since in all likelihood i will turn off QuickViewUnzipReadMe, i personally don't mind when it would be improved... ;) )
Windows 7 Pro x64 SP1

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36554
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2016-06-08, 16:01 UTC

Would it be possible to also have:
QuickViewUnzipReadMe=-1
to show readme or other text files from within ZIP files *after* plugin check?
This is unfortunately not possible - unpacking occurs before quick view is called, and plugins can only be determined when loading them.

But I have still added
QuickViewUnzipReadMe=-1
now, with a different meaning: It will load readme etc. only from regular archives like .zip, in general those with a packer icon. So if you don't install a packer plugin for .epub, TC will show it with the epub plugin.
Author of Total Commander
http://www.ghisler.com

Post Reply