1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

Merge pull request #19449 from Snuffleupagus/autolinking-URL-fuzzy-match

Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
This commit is contained in:
Jonas Jenwald 2025-02-09 22:51:37 +01:00 committed by GitHub
commit 86ae2ca01c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 1 deletions

View file

@ -88,4 +88,37 @@ describe("autolinker", function () {
);
});
});
describe("pr19449.pdf", function () {
let pages;
beforeAll(async () => {
pages = await loadAndWait("pr19449.pdf", ".annotationLayer", null, null, {
docBaseUrl: "http://example.com",
enableAutoLinking: true,
});
});
afterAll(async () => {
await closePages(pages);
});
it("must not add links that overlap even if the URLs are different", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const linkIds = await page.$$eval(
".annotationLayer > .linkAnnotation > a",
annotations =>
annotations.map(a => a.getAttribute("data-element-id"))
);
expect(linkIds.length).withContext(`In ${browserName}`).toEqual(1);
linkIds.forEach(id =>
expect(id)
.withContext(`In ${browserName}`)
.not.toContain("inferred_link_")
);
})
);
});
});
});

View file

@ -276,6 +276,7 @@
!pr6531_1.pdf
!pr6531_2.pdf
!pr7352.pdf
!pr19449.pdf
!bug900822.pdf
!bug1392647.pdf
!issue918.pdf

BIN
test/pdfs/pr19449.pdf Normal file

Binary file not shown.