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

This commit is contained in:
Julian Lam
2024-07-05 11:29:05 -04:00
parent f662a60667
commit d92efb8a0c

View File

@@ -36,6 +36,7 @@ Mocks.profile = async (actors) => {
} }
const uid = actor.id; const uid = actor.id;
let hostname;
let { let {
url, preferredUsername, published, icon, image, url, preferredUsername, published, icon, image,
name, summary, followers, followerCount, followingCount, name, summary, followers, followerCount, followingCount,
@@ -43,7 +44,11 @@ Mocks.profile = async (actors) => {
} = actor; } = actor;
preferredUsername = preferredUsername || slugify(name); preferredUsername = preferredUsername || slugify(name);
const { hostname } = new URL(actor.id); try {
({ hostname } = new URL(actor.id));
} catch (e) {
return null;
}
let picture; let picture;
if (icon) { if (icon) {