johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.26k stars 256 forks source link

Issues with Epub 3.3 Spec Compliance #1234

Closed snnsnn closed 5 months ago

snnsnn commented 5 months ago

Describe the bug

Hi, I was trying to display a Epub 3.3 spec compliant book, but the app kept crashing. I open the book using the terminal command below and I got the error that follows the command:

foliate minimal.epub 

(com.github.johnfactotum.Foliate:6905): Gjs-WARNING **: 00:23:21.932: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
  main@resource:///com/github/johnfactotum/Foliate/js/main.js:478:24
  run@resource:///org/gnome/gjs/modules/script/package.js:206:19
  @/usr/bin/foliate:9:17

I eventually managed to display the book after prunning some content however console still outputs the same error.

The sample book EPUB 3.0 Specification from https://idpf.github.io/epub3-samples/30/samples.html also produces this error.

I created another Epub 3.3 spec compliant book and attached it to the issue. This example does not break the app but it outputs a diferent longer message:

To Reproduce

  1. Download the attached epub document: minimal.zip
  2. Run foliate via terminal vindow: foliate minimal.epub

I had to zip the epub file to be able to upload it.

$ foliate minimal.epub 

(com.github.johnfactotum.Foliate:6443): Gjs-WARNING **: 00:17:18.838: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
  main@resource:///com/github/johnfactotum/Foliate/js/main.js:478:24
  run@resource:///org/gnome/gjs/modules/script/package.js:206:19
  @/usr/bin/foliate:9:17

(com.github.johnfactotum.Foliate:6443): Gtk-CRITICAL **: 00:17:18.955: gtk_tree_store_get_value: assertion 'VALID_ITER (iter, tree_store)' failed

(com.github.johnfactotum.Foliate:6443): GLib-GObject-CRITICAL **: 00:17:18.955: ../../../gobject/gtype.c:4424: type id '0' is invalid

(com.github.johnfactotum.Foliate:6443): GLib-GObject-CRITICAL **: 00:17:18.955: can't peek value table for type '<invalid>' which is not currently referenced

(com.github.johnfactotum.Foliate:6443): GLib-GObject-CRITICAL **: 00:17:18.955: g_value_fits_pointer: assertion 'value_table' failed

(com.github.johnfactotum.Foliate:6443): GLib-GObject-CRITICAL **: 00:17:18.955: g_value_type_transformable: assertion 'src_type' failed

(com.github.johnfactotum.Foliate:6443): GLib-GObject-CRITICAL **: 00:17:18.955: g_value_type_transformable: assertion 'src_type' failed

(com.github.johnfactotum.Foliate:6443): Gjs-CRITICAL **: 00:17:18.956: JS ERROR: Error: Don't know how to convert GType (null) to JavaScript object
set epub/<@resource:///com/github/johnfactotum/Foliate/js/contents.js:139:37
_handleAction@resource:///com/github/johnfactotum/Foliate/js/epubView.js:947:22
_init/<@resource:///com/github/johnfactotum/Foliate/js/epubView.js:617:18
main@resource:///com/github/johnfactotum/Foliate/js/main.js:478:24
run@resource:///org/gnome/gjs/modules/script/package.js:206:19
@/usr/bin/foliate:9:17

Version:

Is there a way to display more useful errors so that we can fix it or downgrade the Epub version if it is not fixable.

johnfactotum commented 5 months ago
  1. v2.x is not supported anymore.
  2. Even in v2.6, both files work despite the error messages.
  3. With v3.1, it opens both files without any errors.
snnsnn commented 5 months ago

3. With v3.1, it opens both files without any errors.

That is good to hear. Maybe it is some changes that is introduced by v3.3. Is there a way if you could emit some info on the error, so that we can address it without downgrading to v3.1.

johnfactotum commented 5 months ago

Sorry for the confusion. To clarify, the version numbers in my comment refer to Foliate versions.

Both your "minimal.epub" and the EPUB 3 spec EPUB work fine, without any errors, in the latest version of Foliate, version 3.1.0.

The version of Foliate you are using, v2.6.4, is not supported anymore. But even with this old version of Foliate I am still able to open and view those files despite the errors.

snnsnn commented 5 months ago

The version of Foliate you are using, v2.6.4, is not supported anymore.

Oh! I installed it using the Kubuntu's built-in app manager Discover, which is at Foliate 2.4 now. I replaced it with Flatpack version, which is 3.1 and I received some cache related warning but everything looks OK. This new version looks stunning. Thank you for taking the time to answer and thank you for all the great work you did.