From d92efb8a0c7fe1f77c5707c4042939c739563ba0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 5 Jul 2024 11:29:05 -0400 Subject: [PATCH] fix: #12667; handle cases where received id is not a URL --- src/activitypub/mocks.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index 208ffa589f..a7435be095 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -36,6 +36,7 @@ Mocks.profile = async (actors) => { } const uid = actor.id; + let hostname; let { url, preferredUsername, published, icon, image, name, summary, followers, followerCount, followingCount, @@ -43,7 +44,11 @@ Mocks.profile = async (actors) => { } = actor; preferredUsername = preferredUsername || slugify(name); - const { hostname } = new URL(actor.id); + try { + ({ hostname } = new URL(actor.id)); + } catch (e) { + return null; + } let picture; if (icon) {