You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removing all malicious picture before generating epub file can resolve this issue. Like this:
// remove all img element that are not specified src attribute, src pointe to img source url:document.querySelectorAll('img:not([src])').forEach(e=>e.remove());// then generate file with correct contentnewEpub(option,"/path/to/book/file/path.epub");
Sometimes, the url is stored in the srcset attribute. We can copy it in the src attribute.
import{JSDOM}from'jsdom';constdoc=newJSDOM(htmlStrContent).window.document;// remove all img element that are missing a src attributedoc.querySelectorAll('img:not([src])').forEach(e=>{if(e.hasAttribute('srcset')){e.setAttribute('src',e.getAttribute('srcset'));}else{e.remove();}});constcontent={title: 'Title',data: doc.body.innerHTML,}
So I've got an error like that
which I fixed by adding if
I don't know if there is more to that - maybe an image wasn't downloaded properly - it fixed error and gave valid epub so...
The text was updated successfully, but these errors were encountered: