johnfactotum / foliate-js

Render e-books in the browser
https://johnfactotum.github.io/foliate-js/reader.html
MIT License
420 stars 60 forks source link

Chapter with broken images can't be rendered #14

Open troyeguo opened 1 year ago

troyeguo commented 1 year ago

When zip.js trys to uncompress these broken images, it will throw header error. But foliate.js doesn't properly catch these error which aborts the whole rendering process.

How to reproduce:

  1. Import this book in https://johnfactotum.github.io/foliate-js/reader.html
  2. Click Chapter 1 Probability

image

johnfactotum commented 1 year ago

Perhaps one should just catch this in the loadBlob function and return an empty Blob (or even a custom placeholder image, if you're feeling fancy)?