Skip to content

fix(server): make OPDS TXT acquisitions openable in Librera - #740

Merged
hectorqin merged 1 commit into
mainfrom
devin/1795662699-opds-txt-interop
Nov 26, 2026
Merged

hectorqin merged 1 commit into
mainfrom
devin/1795662699-opds-txt-interop

Conversation

@hectorqin

@hectorqin hectorqin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the TXT part of #735. Librera FD 10.0.35 (tested on an Android emulator) saved OPDS TXT downloads with no extension (e.g. 412010034.) and couldn't open them. Librera looks up the exact acquisition type, so text/plain; charset=utf-8 never matched TXT, and the /content href had no extension it could fall back on. The same downloaded bytes, renamed to .txt, open correctly.

  • OPDS acquisition link: type is now the bare MIME type (text/plain), and the href is /opds/books/:id/content/<file name>. The old /content URL still works because :filename? is optional.
  • Raw TXT responses no longer claim charset=utf-8. The server streams the original bytes, which may be GBK. Decoded chapter text keeps its UTF-8 label.
  • Content-Disposition adds an ASCII filename="..." fallback before filename*=UTF-8''....

Tests: server/test/opds-server.test.ts covers the advertised URL and type, the headers, unchanged GBK bytes, and access control. Server typecheck, tests and format:check pass.


Julia opened this PR for Qin
Implemented in session Test issue 735 on Android emulator
Review with Devin · Open in Devin Desktop


Co-Authored-By: qin hector <hectorq.me@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Retested dee0bb2 with Librera FD 10.0.35 on an Android 15 emulator. Chinese UTF-8 and GBK TXT books now download through OPDS as .txt and open readably, with no renaming. Legacy /content URLs still return 200, and the bytes are unchanged.

Before the fix, Librera saved the downloads with no extension and couldn't open them (recording of the Android shell test).

Written by Devin

@hectorqin
hectorqin merged commit 2c8e06f into main Nov 26, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

1 participant