jellyfin / jellyfin-plugin-opds

GNU General Public License v3.0
27 stars 4 forks source link

Acquisition links incompatible with KyBook 3 #23

Closed mcoms closed 2 years ago

mcoms commented 2 years ago

The popular iOS OPDS client KyBook 3 refuses to download books from Jellyfin, but will download fine from Calibre's OPDS content server.

iOS returns a MIME type error: IMG_61357689D673-1

curl reports both servers sending the correct MIME type, however Calibre sends the file as an "attachment" (with a Content-Disposition header), whereas Jellyfin streams it inline. As fas as I could see the OPDS spec doesn't have an opinion, but sending the files as an "attachment" may prove compatible with more clients.

# Jellyfin OPDS plugin
< HTTP/1.1 200 OK
< Date: Sat, 12 Mar 2022 20:52:28 GMT
< Content-Type: application/epub+zip
< Server: Kestrel
< Content-Length: 1035996
< Last-Modified: Sat, 12 Mar 2022 17:34:06 GMT
< X-Response-Time-ms: 396
# Calibre Content Server
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Disposition: attachment; filename="test book.epub"; filename*=utf-8''test%20book.epub
< Content-Length: 1036177
< Content-Type: application/epub+zip
< Date: Sat, 12 Mar 2022 20:53:25 GMT
< ETag: "1978996d9342fb71526ca69f51f818a6ee5a4de7"
< Keep-Alive: timeout=120
< Server: calibre 5.38.0

Jellyfin Docker image latest (10.7.7). Plugin version 1.0.0.0.

I have raised an issue on the client side: https://github.com/kolyvan/kybook/issues/438

crobibero commented 2 years ago

I've added what I think is the fix, but I don't have any iOS devices to test with. I've attached the build artifacts to the PR if you are able to test for me

mcoms commented 2 years ago

Thanks @crobibero, that's perfect.

Tested using Jellyfin 10.8.0-alpha5:

docker run --rm -p 8096:8096 -v $(pwd)/media:/media -v $(pwd)/config:/config -v $(pwd)/cache:/cache jellyfin/jellyfin:10.8.0-alpha5

Installing OPDS 4.0.0.0 from the repository gives me the same error as before: IMG_1335

Installing 5.0.0.0 from your build artefact works and I can download books as expected: IMG_1336

Tested a few books (.epub, .mobi, .pdf), and general browsing of the catalogue, all working fine, so this has fixed it :+1: Thanks!