From 9bd23fc1d77f1f47c4c79647fc87a61c8a0980a0 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 7 Jun 2026 00:27:04 -0400 Subject: [PATCH] fix(reader): stop sending epubcfi for fixed-layout documents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The web reader's saveProgress always sent epubcfi: cfi || "", even for fixed-layout comics/PDFs. Foliate's comic renderer generates a fake CFI (epubcfi(/6/{n})) for every page via CFI.fake.fromIndex, which the server stored as a valid locator. These fake CFIs are meaningless — the page index is the canonical locator for image-based content — and they caused koreader to crash on pull (see prior commit). Only set epubcfi in the request body for reflowable documents. --- web/src/reader/reader.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/reader/reader.ts b/web/src/reader/reader.ts index 5fc5080..0ff9d53 100644 --- a/web/src/reader/reader.ts +++ b/web/src/reader/reader.ts @@ -562,9 +562,11 @@ document.addEventListener("alpine:init", () => { ? this.book?.sections?.filter((s: any) => s.linear !== "no") ?.length ?? 0 : location?.total ?? 0, - epubcfi: cfi || "", reading_mode: this.readingMode || undefined, }; + if (!this.isFixedLayout) { + body.epubcfi = cfi || ""; + } const tocItem = this.lastRelocateDetail?.tocItem; if (tocItem) {