Skip to content

Node.js based forum software built for the modern web

fix: #12667; handle cases where received id is not a URL

Julian Lamd92efb8a0c7f
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) {