johnfactotum / foliate-js

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

Chapter with broken images can't be rendered #14

Open troyeguo opened 9 months ago

troyeguo commented 9 months 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 9 months 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)?