From b4e8ed437142b6821da74a09e5dbeebe6b8703de Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Tue, 18 Jun 2024 08:46:45 +0300 Subject: [PATCH] Fix URL parsing --- src/core/module/link/parsed-overlays.js | 3 ++- src/core/module/outline-reader.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/module/link/parsed-overlays.js b/src/core/module/link/parsed-overlays.js index 8777ad61fc991..0129079d04be0 100644 --- a/src/core/module/link/parsed-overlays.js +++ b/src/core/module/link/parsed-overlays.js @@ -44,7 +44,8 @@ export function getParsedOverlays(chars) { let text = ''; for (let j = sequence.from; j <= sequence.to; j++) { let char = chars[j]; - text += char.c; + // Use the original char to avoid decomposed ligatures increasing match length + text += char.u; } let match = text.match(urlRegExp); if (match) { diff --git a/src/core/module/outline-reader.js b/src/core/module/outline-reader.js index 75a7eef4359d1..ceb81c819db9e 100644 --- a/src/core/module/outline-reader.js +++ b/src/core/module/outline-reader.js @@ -1,5 +1,8 @@ import { getPositionFromDestination, getSortIndex } from './util.js'; +// TODO: +// - If root node is single and is a document title, remove it and use its children as top level nodes + async function getSortIndexFromTitle(pdfDocument, structuredCharsProvider, title, dest){ let position = await getPositionFromDestination(pdfDocument, dest); if (!position) {