From 5e62dd79cd91d2d7048678c491c0c7c20b74f124 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Fri, 27 Feb 2026 11:09:42 +0100 Subject: [PATCH] Fix comparison --- lib/KOReaderSync/ChapterXPathIndexer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/KOReaderSync/ChapterXPathIndexer.cpp b/lib/KOReaderSync/ChapterXPathIndexer.cpp index ceb5c52b..28635486 100644 --- a/lib/KOReaderSync/ChapterXPathIndexer.cpp +++ b/lib/KOReaderSync/ChapterXPathIndexer.cpp @@ -129,7 +129,8 @@ struct ParserState { bool found = false; for (const auto& anchor : anchors) { - const std::string anchorPath = ignoreIndices ? removeIndices(anchor.xpath) : anchor.xpath; + const std::string normalizedAnchor = normalizeXPath(anchor.xpath); + const std::string anchorPath = ignoreIndices ? removeIndices(normalizedAnchor) : normalizedAnchor; if (anchorPath == probe) { const int depth = pathDepth(anchorPath); if (!found || depth > bestDepth || (depth == bestDepth && anchor.textOffset < bestOffset)) {