diff --git a/CHANGELOG.md b/CHANGELOG.md index b35150ff0..28276b962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - The page navigation sidebar no longer incorrectly includes re-exports if the same member is exported with multiple names #2625. - Page navigation now ensures the current page is visible when the page is first loaded, #2626. +- If a relative linked image is referenced multiple times, TypeDoc will no longer sometimes produce invalid links to the image #2627. - Comments on re-exports are now rendered. ### Thanks! diff --git a/src/lib/models/FileRegistry.ts b/src/lib/models/FileRegistry.ts index cedd8add3..d55de0a9a 100644 --- a/src/lib/models/FileRegistry.ts +++ b/src/lib/models/FileRegistry.ts @@ -61,6 +61,10 @@ export class FileRegistry { const absolute = this.mediaToPath.get(id); if (!absolute) return; + if (this.names.has(id)) { + return this.names.get(id); + } + const file = basename(absolute); if (!this.nameUsage.has(file)) { this.nameUsage.set(file, 1); diff --git a/src/test/comments.test.ts b/src/test/comments.test.ts index e15ce775f..d0f7f7946 100644 --- a/src/test/comments.test.ts +++ b/src/test/comments.test.ts @@ -1509,6 +1509,7 @@ describe("Comment Parser", () => { ] satisfies CommentDisplayPart[]); equal(files.getName(1), "&a.png"); + equal(files.getName(1), "&a.png"); }); });