Skip to content

Node.js based forum software built for the modern web

fix: handle webfinger responses with subject missing scheme

Julian Lam4967492f4f65
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js
index a8c5532980..cc4892acb6 100644
--- a/src/activitypub/helpers.js
+++ b/src/activitypub/helpers.js
@@ -131,9 +131,12 @@ Helpers.query = async (id) => {
({ href: actorUri } = actorUri);
}
- const { subject, publicKey } = body;
+ let { subject, publicKey } = body;
+ // Fix missing scheme
+ if (!subject.startsWith('acct:') && !subject.startsWith('did:')) {
+ subject = `acct:${subject}`;
+ }
const payload = { subject, username, hostname, actorUri, publicKey };
-
const claimedId = new URL(subject).pathname;
webfingerCache.set(claimedId, payload);
if (claimedId !== id) {