Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/integration/autolinker_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,43 @@ describe("autolinker", function () {
});
});

describe("issue21458.pdf", function () {
let pages;

beforeEach(async () => {
pages = await loadAndWait(
"issue21458.pdf",
".page[data-page-number='1'] .annotationLayer",
null,
null,
{ enableAutoLinking: true }
);
});

afterEach(async () => {
await closePages(pages);
});

it("must not add links that overlap internal destinations", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await waitForLinkAnnotations(page);
const linkIds = await page.$$eval(
".page[data-page-number='1'] .annotationLayer > .linkAnnotation > a",
annotations =>
annotations.map(a => a.getAttribute("data-element-id"))
);
expect(linkIds.length).withContext(`In ${browserName}`).toEqual(42);
linkIds.forEach(id =>
expect(id)
.withContext(`In ${browserName}`)
.not.toContain("inferred_link_")
);
})
);
});
});

describe("PR 19470", function () {
let pages;

Expand Down
1 change: 1 addition & 0 deletions test/pdfs/issue21458.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/user-attachments/files/28985267/Gumbel.Distillation.pdf
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
"link": true,
"type": "other"
},
{
"id": "issue21458",
"file": "pdfs/issue21458.pdf",
"md5": "875754beca276ab63568e06fd49e8375",
"rounds": 1,
"link": true,
"type": "other"
},
{
"id": "filled-background-range",
"file": "pdfs/filled-background.pdf",
Expand Down
5 changes: 1 addition & 4 deletions web/annotation_layer_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,7 @@ class AnnotationLayerBuilder {
let linkAreaRects;

for (const annotation of this.#annotations) {
if (
annotation.annotationType !== AnnotationType.LINK ||
!annotation.url
) {
if (annotation.annotationType !== AnnotationType.LINK) {
continue;
}
// TODO: Add a test case to verify that we can find the intersection
Expand Down
Loading