From 5baa46d0bcb3f5c2f0c1d4be631e78420d812484 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Feb 2025 17:58:54 -0500 Subject: [PATCH] fix: handle cases where url passed to mime does not pass because url contained a query string --- src/activitypub/mocks.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index 95274fae89..5e26329f1f 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -201,6 +201,13 @@ Mocks.post = async (objects) => { image = null; } } + if (image) { + const parsed = new URL(image); + if (!mime.getType(parsed.pathname).startsWith('image/')) { + activitypub.helpers.log(`[activitypub/mocks.post] Received image not identified as image due to MIME type: ${image}`); + image = null; + } + } const payload = { uid,