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,