fix: handle webfinger responses with subject missing scheme

This commit is contained in:
Julian Lam
2025-08-26 11:53:27 -04:00
parent 1e0fb20db4
commit 4967492f4f

View File

@@ -131,9 +131,12 @@ Helpers.query = async (id) => {
({ href: actorUri } = actorUri); ({ 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 payload = { subject, username, hostname, actorUri, publicKey };
const claimedId = new URL(subject).pathname; const claimedId = new URL(subject).pathname;
webfingerCache.set(claimedId, payload); webfingerCache.set(claimedId, payload);
if (claimedId !== id) { if (claimedId !== id) {