Node.js based forum software built for the modern web
fix: image handling when image url received is not a path with an extension
Julian Lamb4ff79061f80
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.jsindex e5a8e8e363..e1e9d82b69 100644--- a/src/activitypub/mocks.js+++ b/src/activitypub/mocks.js@@ -84,7 +84,7 @@ Mocks._normalize = async (object) => {content = '<em>This post did not contain any content.</em>';}- switch (true) {+ switch (true) { // image handlingcase 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;}