mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: guard against crash when malformed URL present in deliverees
This commit is contained in:
@@ -135,11 +135,17 @@ ActivityPub.resolveInboxes = async (ids) => {
|
|||||||
// Filter out blocked instances
|
// Filter out blocked instances
|
||||||
const blocked = [];
|
const blocked = [];
|
||||||
inboxArr = inboxArr.filter((inbox) => {
|
inboxArr = inboxArr.filter((inbox) => {
|
||||||
const { hostname } = new URL(inbox);
|
let allowed = false;
|
||||||
const allowed = ActivityPub.instances.isAllowed(hostname);
|
try {
|
||||||
if (!allowed) {
|
const { hostname } = new URL(inbox);
|
||||||
blocked.push(inbox);
|
allowed = ActivityPub.instances.isAllowed(hostname);
|
||||||
|
if (!allowed) {
|
||||||
|
blocked.push(inbox);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
winston.warn(`[activitypub/resolveInboxes] Malformed URL encountered while filtering out blocked instances: ${inbox}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return allowed;
|
return allowed;
|
||||||
});
|
});
|
||||||
if (blocked.length) {
|
if (blocked.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user