mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #12667; handle cases where received id is not a URL
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user