Merge pull request #3827 from annando/hubzilla-webfinger

Hubzilla doesn't return the handle in the hcard
This commit is contained in:
Tobias Diekershoff 2017-10-27 09:47:47 +02:00 committed by GitHub
commit 992b721de6
3 changed files with 6 additions and 4 deletions

View File

@ -1134,7 +1134,8 @@ class Diaspora {
return false; return false;
// This will work for new Diaspora servers and Friendica servers from 3.5 // This will work for new Diaspora servers and Friendica servers from 3.5
$source_url = $server."/fetch/post/".$guid; $source_url = $server."/fetch/post/".urlencode($guid);
logger("Fetch post from ".$source_url, LOGGER_DEBUG); logger("Fetch post from ".$source_url, LOGGER_DEBUG);
$envelope = fetch_url($source_url); $envelope = fetch_url($source_url);
@ -1150,7 +1151,7 @@ class Diaspora {
// This will work for older Diaspora and Friendica servers // This will work for older Diaspora and Friendica servers
if (!$x) { if (!$x) {
$source_url = $server."/p/".$guid.".xml"; $source_url = $server."/p/".urlencode($guid).".xml";
logger("Fetch post from ".$source_url, LOGGER_DEBUG); logger("Fetch post from ".$source_url, LOGGER_DEBUG);
$x = fetch_url($source_url); $x = fetch_url($source_url);

View File

@ -24,7 +24,7 @@ function xrd_init(App $a) {
if(substr($uri,0,4) === 'http') { if(substr($uri,0,4) === 'http') {
$acct = false; $acct = false;
$name = basename($uri); $name = ltrim(basename($uri), '~');
} else { } else {
$acct = true; $acct = true;
$local = str_replace('acct:', '', $uri); $local = str_replace('acct:', '', $uri);

View File

@ -1093,7 +1093,6 @@ class Probe {
* @return array Diaspora data * @return array Diaspora data
*/ */
private static function diaspora($webfinger) { private static function diaspora($webfinger) {
$hcard_url = ""; $hcard_url = "";
$data = array(); $data = array();
foreach ($webfinger["links"] as $link) { foreach ($webfinger["links"] as $link) {
@ -1129,6 +1128,8 @@ class Probe {
foreach ($webfinger["aliases"] as $alias) { foreach ($webfinger["aliases"] as $alias) {
if (normalise_link($alias) != normalise_link($data["url"]) && ! strstr($alias, "@")) { if (normalise_link($alias) != normalise_link($data["url"]) && ! strstr($alias, "@")) {
$data["alias"] = $alias; $data["alias"] = $alias;
} elseif (substr($alias, 0, 5) == 'acct:') {
$data["addr"] = substr($alias, 5);
} }
} }
} }