Closed romikforest closed 1 year ago
@romikforest Is this related to gerhardsletten/react-reader#handling-missing-mime-types-on-server
Hi. No, it's about the additional query parameters that s3 presigned urls have. I've found that the reader accepts a blob for the url parameter. So as a workaround I download the file and then pass the blob to the reader.
@romikforest Did you see this old issue: #49
No. I haven't seen. It works that way too.
But actually I don't sure what it has with mime. S3 returns application/epub+zip for the file (sets it automatically on upload). The head requests aren't working with the urls. Somebody can get the mime with zero range GET that has the same effect as HEAD request:
const reponse = await fetch(url, {
headers: {range: 'bytes=0-0'}
});
const mime = reponse.headers.get('Content-Type');
console.log(mime);
I think you would need it if the path url do not contain ".epub" at the end. This is related to inner workings of epubjs
Ok. Thank you a lot for your support.
Just as a remark. As I said some one can also use blobs:
const blob = await fetch(s3url).then(r => r.blob());
setUrl(blob)
Is there a solution for the s3 presigned urls?