Fix pull sync rejecting every annotation: off-by-one in pos0 validation
isValidPos0 compared pos0:sub(1,7) against the 6-char string '/body/', so it tested '/body/D' == '/body/' — false for every CRE xpointer, and applyServerAnnotations silently dropped ALL pulled highlights/notes/ bookmarks on rolling documents. Caught by running the real plugin code against the live server in a stubbed KOReader harness: push stored rows on the server, pull applied nothing — matching the reported 'neither direction syncs' symptom. sub(1,6) now matches. Both directions re-verified end-to-end through the actual plugin: a KOReader-style highlight pushes and lands in the server DB (with server-derived percentage), and a metadata pull populates a fresh device's bookmark list with web- and device-sourced highlights (xpointer pos0s) plus web bookmarks (numeric page pos0s on paging documents).
This commit is contained in:
@@ -1174,7 +1174,7 @@ function Bookhoard:applyServerAnnotations(annotations)
|
|||||||
if has_pages then
|
if has_pages then
|
||||||
return tonumber(pos0) ~= nil
|
return tonumber(pos0) ~= nil
|
||||||
end
|
end
|
||||||
return pos0:sub(1, 7) == "/body/"
|
return pos0:sub(1, 6) == "/body/"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function addOrUpdate(server_entry, has_text)
|
local function addOrUpdate(server_entry, has_text)
|
||||||
|
|||||||
Reference in New Issue
Block a user