From 3e574fd637e910463952297c980f0542f4d1aaac Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 18 Apr 2025 18:24:01 -0600 Subject: [PATCH] fedimbed: mastodon makes every attachment Document smh --- src/modules/fedimbed.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 5e26937..afa1ed6 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -1167,7 +1167,8 @@ async function processUrl(msg, url, spoiler = false, command = false) { const attachments = Array.isArray(postData.attachment) ? postData.attachment : [postData.attachment]; for (const attachment of attachments) { if (attachment.url) { - const type = attachment.type?.toLowerCase(); + const type = attachment.type?.toLowerCase() ?? ""; + const mediaType = attachment.mediaType ?? ""; let attUrl = attachment.url; if (Array.isArray(attachment.url)) { @@ -1188,17 +1189,17 @@ async function processUrl(msg, url, spoiler = false, command = false) { } const attDesc = attachment.name ?? attachment.description ?? attachment.comment; - if (type.startsWith("image")) { + if (type.startsWith("image") || mediaType.startsWith("image")) { images.push({ media: {url: attUrl}, description: attDesc?.length > 0 ? attDesc : null, }); - } else if (type.startsWith("video")) { + } else if (type.startsWith("video") || mediaType.startsWith("video")) { videos.push({ media: {url: attUrl}, description: attDesc?.length > 0 ? attDesc : null, }); - } else if (type.startsWith("audio")) { + } else if (type.startsWith("audio") || mediaType.startsWith("audio")) { audios.push({ url: attUrl, description: attDesc?.length > 0 ? attDesc : null,