From 70e7fdee0401c27dad9fe580195f00f583e0b4b0 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 2 Apr 2024 21:49:06 -0600 Subject: [PATCH] fedimbed: dont error on weird attachment structures --- src/modules/fedimbed.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 9e953d9..65609cf 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -508,7 +508,7 @@ async function processUrl(msg, url, spoiler = false) { type: attachment.mediaType, }); } - } else { + } else if (attachment.url) { const contentType = await fetch(attachment.url, { method: "HEAD", }).then((res) => res.headers.get("Content-Type")); @@ -572,6 +572,10 @@ async function processUrl(msg, url, spoiler = false) { }); } } + } else { + logger.warn( + `Unhandled attachment structure! ${JSON.stringify(attachment)}` + ); } }