Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading an epub from a generator script. #109

Open
dsancheznet opened this issue Jan 6, 2021 · 3 comments
Open

Loading an epub from a generator script. #109

dsancheznet opened this issue Jan 6, 2021 · 3 comments

Comments

@dsancheznet
Copy link

dsancheznet commented Jan 6, 2021

Hello everybody, I am the author of mybrary and I'm happy to announce that I'm working on an integration of bibi into the system as an online epub reader for books stored in the library. I'm having problems loading a book that is streamed by a php script. The script does something like (abbreviated example):

    header('Content-Type: application/epub+zip');
    header("Pragma: no-cache");
    header("Expires: 0");
    echo file_get_contents( $epubData );   

The reason I'm doing it this way is that I do not want to expose the file to unauthenticated users. Doe to this reason, all books and covers are stored in a non public directory, out of reach of the web users. I have been adapting the js files quite heavily to be able to integrate the script into my file structure. As soon as I try to load a book streamed by the downloader script, I get the following error:

image

I am calling the reader in the following manner:

epub.html?book=getbook.php?id%3D1.epub"

Does somebody have a clue on what could be happening? Is it even possible to load en epub this way?

By the way: I'm using PDF.js as well, and it works without flaws calling it this way.

Best regards
D.Sánchez

@satorumurmur
Copy link
Owner

@dsancheznet
Thank you for using Bibi.
I haven't identified the cause yet, but it's possible that there is a potential problem with Bibi.
Can you send me the EPUB file you tried?
(Because it can occur with EPUBs which have certain conditions.)

@dsancheznet
Copy link
Author

dsancheznet commented Jan 8, 2021

Sending the epub would be no problem, but I don't think that the problem is in BiB/i because when I drop the file locally it opens without any problem. The problem only appears, when the file is to be opened remotely. (Anyway, if you want, please provide me with an email address to send you the file, because it is copyrighted and I can not post it publicly)

Best regards

@dsancheznet
Copy link
Author

I think I have found the error!

BiB/i does not examine the header of a file stream, that is why bibi.js was thinking that the file I was trying to load was an unzipped directory structure. After appending &fake=file.epub to the html, everything worked because a valid file ending could be found.

Maybe in the future you want to correct that behaviour.

Best regards
D.Sánchez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants