futurepress / epubjs-reader

Epub.js Reader
MIT License
449 stars 131 forks source link

META-INF/container.xml error while serving epub file as web api #20

Open purusingh opened 6 years ago

purusingh commented 6 years ago

When I send the file using static file path it works but if I serve file as res.sendFile(..) it is not working and not even hitting this api?

I am getting META-INF/container.xml is not found error?

What do I have to do in order to make it work.

Thank You

jdupl commented 6 years ago

Hey fixed it by adding /file.epub at the end of the url. Looks pretty wacko. I was doing /download/<id> now I have to do download/<id>/file.epub

AndreevskiAleksandar commented 5 years ago

@jdupl Thank you so much!!! I have refactored and changed the code for the past 2 hours just to find out that all that was missing is the .epub suffix at the end of the api route...

mananshah88 commented 4 years ago

@jdupl For me, it is angular-epub-viewer which reads the CDN presigned URL. But the above solution worked. ( During uploading, I forgot to add extension".epub" in the file name. )

dhiv-nitt commented 4 years ago

@jdupl How did you go about solving this issue ? the URL which i am passing is a blob url that has a token parameter. it is giving me the same error : image

Troplo commented 2 years ago

help

Troplo commented 2 years ago

help

Troplo commented 2 years ago

please, I am unable to live without this project

saadjutt01 commented 2 years ago

It's part of standard defined here: https://www.w3.org/publishing/epub3/epub-ocf.html#sec-container-metainf-container.xml

jbescos commented 2 years ago

I was having this issue in this project, but Google brought me here.

I was debugging this, the issue is the Zip was created having the ZipEntry in Windows: META-INF\container.xml

But unfortunately, this check is not passing: https://github.com/w3c/epubcheck/blob/58a61935a8fdd2875539be58dc6bc1ed87615740/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java#L116

This is because the value of that constant contains this path: META-INF/container.xml https://github.com/w3c/epubcheck/blob/58a61935a8fdd2875539be58dc6bc1ed87615740/src/main/java/com/adobe/epubcheck/ocf/OCFData.java#L9

It is failing to pass that check, even having the file inside the ZIP, because of that.

I have created an issue here: https://github.com/w3c/epubcheck/issues/1357

aino-pranu commented 1 year ago

I have a solution for this

When you Loading ePub from a blob URL, then you should do the following things

async result => {
var byteArray = new Uint8Array(result['byteArray']);

      var blob = new Blob([byteArray], { type: 'application/epub+zip' });

      //This is an important
      const objectUrl = await blob.arrayBuffer();

      //This method is of epub
      readFile(objectUrl);
    }
dpakakpo4 commented 1 month ago

Hi all,

I use this setup in React Native and it works, thanks to you all,

https://mydomain.com/staticfolder/${accessToken}/${id}.epub

So when the epub reader get the epub file on my nodejs server, I authenticate it using the accessToken via an authentication middleware in nodejs.