diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index e5a8e8e363..e1e9d82b69 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -84,7 +84,7 @@ Mocks._normalize = async (object) => { content = 'This post did not contain any content.'; } - switch (true) { + switch (true) { // image handling case image && image.hasOwnProperty('url') && !!image.url: { image = image.url; break; @@ -101,7 +101,8 @@ Mocks._normalize = async (object) => { } if (image) { const parsed = new URL(image); - if (!mime.getType(parsed.pathname).startsWith('image/')) { + const type = mime.getType(parsed.pathname); + if (!type || type.startsWith('image/')) { activitypub.helpers.log(`[activitypub/mocks.post] Received image not identified as image due to MIME type: ${image}`); image = null; }