remove acct: scheme from webfinger address before use

This commit is contained in:
Mike Macgirvin 2024-08-17 06:34:48 +10:00
parent 66adb75da2
commit c8847068b2

View file

@ -2447,7 +2447,9 @@ class Activity
$username = escape_tags($actorRecord['preferredUsername']); $username = escape_tags($actorRecord['preferredUsername']);
$h = parse_url($url); $h = parse_url($url);
$webfingerAddress = escape_tags($actorRecord['webfinger'] ?? $username . '@' . $h['host']); $webfingerAddress = escape_tags($actorRecord['webfinger']
? str_replace('acct:', '', $actorRecord['webfinger'])
: $username . '@' . $h['host']);
$icon = self::getIcon($actorRecord['icon']); $icon = self::getIcon($actorRecord['icon']);
@ -2835,7 +2837,7 @@ class Activity
$prefix = $gateway . '/.well-known/apgateway/' . $portableId; $prefix = $gateway . '/.well-known/apgateway/' . $portableId;
$machineName = $actorRecord['preferredUsername'] ?? 'unknown'; $machineName = $actorRecord['preferredUsername'] ?? 'unknown';
$webfingerAddress = $actorRecord['webfinger'] ?? $machineName . '@' . $parsedUrl['host']; $webfingerAddress = $actorRecord['webfinger'] ? str_replace('acct:', '', $actorRecord['webfinger']) : $machineName . '@' . $parsedUrl['host'];
$existing = q("select * from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' and hubloc_network = '%s'", $existing = q("select * from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' and hubloc_network = '%s'",
dbesc($portableId), dbesc($portableId),