From 795b79c2a2a23edc006468cf1b728a4b16ef8fb6 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Fri, 27 Mar 2026 22:50:55 +0000 Subject: [PATCH] support audio imports --- .../services/import-attachment.service.ts | 30 +++++++++++++++++++ 1 file changed, 30 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 a797ecc6..a4da955d 100644 --- a/apps/server/src/integrations/import/services/import-attachment.service.ts +++ b/apps/server/src/integrations/import/services/import-attachment.service.ts @@ -335,6 +335,28 @@ export class ImportAttachmentService { unwrapFromParagraph($, $vid); } + // audio + for (const audEl of $('audio').toArray()) { + const $aud = $(audEl); + const src = cleanUrlString($aud.attr('src') ?? '')!; + if (!src || src.startsWith('http')) continue; + + const relPath = resolveRelativeAttachmentPath( + src, + pageDir, + attachmentCandidates, + ); + if (!relPath) continue; + + const { attachmentId, apiFilePath } = processFile(relPath); + + $aud + .attr('src', apiFilePath) + .attr('data-attachment-id', attachmentId); + + unwrapFromParagraph($, $aud); + } + //
for (const el of $('div[data-type="attachment"]').toArray()) { const $oldDiv = $(el); @@ -401,6 +423,8 @@ export class ImportAttachmentService { const { attachmentId, apiFilePath, abs } = processFile(relPath); const ext = path.extname(relPath).toLowerCase(); + const audioExtensions = new Set(['.mp3', '.wav', '.ogg', '.m4a', '.webm', '.flac', '.aac']); + if (ext === '.mp4') { const $video = $('