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

Download URL blocked by Kobo's experimental browser #2990

Open
WesleyHilhorst opened this issue Jan 28, 2024 · 0 comments
Open

Download URL blocked by Kobo's experimental browser #2990

WesleyHilhorst opened this issue Jan 28, 2024 · 0 comments

Comments

@WesleyHilhorst
Copy link

WesleyHilhorst commented Jan 28, 2024

Describe the bug/problem

It seems Kobo has added an extra requirement to successfully download a kepub file. As is known, the file downloading should end with .epub. Now not only the Content-Disposition header should be changed, but it seems that also the file path seems to be required to link to a filename the browser can download.

Possible fix

I am not a Python/Flask/Jinja developer, but I have found a workaround which works for my case. I am pretty sure it wouldn't be a "correct" fix for the general codebase. I am sure a seasoned Python developer can fix this in no-time at all :-).

My fix is changing the detail.html template. Wherever a download URL is created, I append the .epub in case the kepub format is used. In general, I can see it doesn't really matter what is put in the last part of the download URL for the inner workings of calibre-web since the route does not use this part of the path.

The change would be:

<a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}"

To

<a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower|replace('kepub', 'kepub.epub')) }}"

To reproduce the problem

Steps to reproduce the behavior:

  1. Go to the experimental web browser on Kobo
  2. Find a kepub formatted file
  3. Try to download
  4. Nothing happens due to the browser not wanting to download the file
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

1 participant