Skip to content
New issue

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

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

Already on GitHub? # to your account

Download URL blocked by Kobo's experimental browser #2990

Closed
WesleyHilhorst opened this issue Jan 28, 2024 · 1 comment
Closed

Download URL blocked by Kobo's experimental browser #2990

WesleyHilhorst opened this issue Jan 28, 2024 · 1 comment

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
@OzzieIsaacs
Copy link
Collaborator

I applied the fix to all relevant places. Please update to the newest nightly version

OzzieIsaacs added a commit that referenced this issue Aug 15, 2024
Final fix for cover size during kobo sync (fix for #2523)
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants