fix: crash in resolveInboxes

2025-11-13T12:38:44.161Z [4568/2508892] - error: uncaughtException: Invalid URL
TypeError: Invalid URL
    at new URL (node:internal/url:818:25)
    at /home/saas/nodebb/src/activitypub/index.js:123:25
    at Array.filter (<anonymous>)
    at ActivityPub.resolveInboxes (/home/saas/nodebb/src/activitypub/index.js:122:13)
    at ActivityPub.send (/home/saas/nodebb/src/activitypub/index.js:424:36)
    at Object.announce (/home/saas/nodebb/src/activitypub/feps.js:72:20)
This commit is contained in:
Barış Soner Uşaklı
2025-11-13 12:25:16 -05:00
parent 5d9da6035e
commit 9900171f24

View File

@@ -119,8 +119,13 @@ ActivityPub.resolveInboxes = async (ids) => {
if (!meta.config.activitypubAllowLoopback) {
ids = ids.filter((id) => {
const { hostname } = new URL(id);
return hostname !== nconf.get('url_parsed').hostname;
try {
const { hostname } = new URL(id);
return hostname !== nconf.get('url_parsed').hostname;
} catch (err) {
winston.error(`[activitypub/resolveInboxes] Invalid id: ${id}`);
return false;
}
});
}