fix: resolveLocalId to return null values instead of throwing for no resolution

This commit is contained in:
Julian Lam
2024-02-09 11:15:03 -05:00
parent ac56289fa2
commit 11dba85d0a
2 changed files with 10 additions and 4 deletions

View File

@@ -107,15 +107,15 @@ Helpers.resolveLocalId = async (input) => {
}
}
throw new Error('[[error:activitypub.invalid-id]]');
} else {
throw new Error('[[error:activitypub.invalid-id]]');
return { type: null, id: null };
}
return { type: null, id: null };
} else if (input.indexOf('@') !== -1) { // Webfinger
const [slug] = input.replace(/^acct:/, '').split('@');
const uid = await user.getUidByUserslug(slug);
return { type: 'user', id: uid };
}
throw new Error('[[error:activitypub.invalid-id]]');
return { type: null, id: null };
};