commit 45d7d89

grunfink  ·  2026-04-06 09:39:15 +0000 UTC
parent fc1789a
Webfinger: if the 'subject' is not an acct:, search in 'aliases'.

Implementations like Hubzilla return a subject that is an http: instead of an acct:,
but have one in the 'aliases' array, so use it.
1 files changed,  +16, -0
+16, -0
 1@@ -96,6 +96,22 @@ int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str
 2 
 3             if (subject && xs_startswith(subject, "acct:"))
 4                 *user = xs_replace_n(subject, "acct:", "", 1);
 5+            else {
 6+                /* subject not an 'acct:': try in the aliases
 7+                   (i.e. hubzilla does this) */
 8+                const char *aliases = xs_dict_get(obj, "aliases");
 9+
10+                if (xs_is_list(aliases)) {
11+                    const char *v;
12+
13+                    xs_list_foreach(aliases, v) {
14+                        if (xs_startswith(v, "acct:")) {
15+                            *user = xs_replace_n(v, "acct:", "", 1);
16+                            break;
17+                        }
18+                    }
19+                }
20+            }
21         }
22 
23         if (actor != NULL) {