Skip to content

Node.js based forum software built for the modern web

fix(activitypub): don't double-encode non-ASCII handles in webfinger query

Enes Uysal457a9702f193
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js
index 11ab4cc6d2..1d3122068c 100644
--- a/src/activitypub/helpers.js
+++ b/src/activitypub/helpers.js
@@ -114,7 +114,9 @@ Helpers.query = async (id) => {
return cached;
}
- const query = new URLSearchParams({ resource: uri });
+ // Build the resource from the raw id; URL serialization percent-encodes non-ASCII
+ // characters, which URLSearchParams would then encode a second time
+ const query = new URLSearchParams({ resource: isUri ? uri.href : `acct:${username}@${hostname}` });
// Make a webfinger query to retrieve routing information
let response;