From 3e5a1f73ea2fbe1bcf87f5351c4630b568ef10a6 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:38:27 +0100 Subject: [PATCH] fix media links --- .../import/services/import-attachment.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/server/src/integrations/import/services/import-attachment.service.ts b/apps/server/src/integrations/import/services/import-attachment.service.ts index 3c14d854..c9fb7a12 100644 --- a/apps/server/src/integrations/import/services/import-attachment.service.ts +++ b/apps/server/src/integrations/import/services/import-attachment.service.ts @@ -193,6 +193,8 @@ export class ImportAttachmentService { // Build a map from resolved archive path → real filename from Confluence // metadata. Confluence Server archives often store files under numeric IDs // (e.g. "attachments/65601/65602") instead of the original filename. + // Also register aliases so HTML references using the original filename + // (e.g. "attachments/pageId/original.mp3") resolve to the numeric path. const pageDir = path.dirname(pageRelativePath); const attachmentNameByRelPath = new Map(); for (const attachment of pageAttachments) { @@ -203,6 +205,13 @@ export class ImportAttachmentService { ); if (relPath && attachment.fileName) { attachmentNameByRelPath.set(relPath, attachment.fileName); + + const dir = path.posix.dirname(relPath); + const aliasKey = `${dir}/${attachment.fileName}`; + if (!attachmentCandidates.has(aliasKey)) { + attachmentCandidates.set(aliasKey, attachmentCandidates.get(relPath)!); + attachmentNameByRelPath.set(aliasKey, attachment.fileName); + } } }