mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 20:41:17 +01:00
fix: remove unnecessary check and guard against unsupported URIs before fetching
This commit is contained in:
@@ -33,7 +33,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
const originalId = id;
|
const originalId = id;
|
||||||
const isUri = activitypub.helpers.isUri(id);
|
const isUri = activitypub.helpers.isUri(id);
|
||||||
// only look up webfinger if the id is not a supported URI
|
// only look up webfinger if the id is not a supported URI
|
||||||
if (id.includes('@') && !(isUri && activitypub._constants.acceptedProtocols.includes(new URL(id).protocol.slice(0, -1)))) {
|
if (id.includes('@') && !isUri) {
|
||||||
const host = isUri ? new URL(id).host : id.split('@')[1];
|
const host = isUri ? new URL(id).host : id.split('@')[1];
|
||||||
if (host === nconf.get('url_parsed').host) { // do not assert loopback ids
|
if (host === nconf.get('url_parsed').host) { // do not assert loopback ids
|
||||||
return 'loopback';
|
return 'loopback';
|
||||||
@@ -41,8 +41,10 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
|
|
||||||
({ actorUri: id } = await activitypub.helpers.query(id));
|
({ actorUri: id } = await activitypub.helpers.query(id));
|
||||||
}
|
}
|
||||||
if (!id) {
|
// ensure the final id is a valid URI
|
||||||
|
if (!id || !activitypub.helpers.isUri(id)) {
|
||||||
failedWebfingerCache.set(originalId, true);
|
failedWebfingerCache.set(originalId, true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
})));
|
})));
|
||||||
|
|||||||
Reference in New Issue
Block a user