From 0b7e8b7fb45330c64df3cb00f70600f725c38c93 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 27 Oct 2017 06:17:24 +0000 Subject: [PATCH] Hubzilla doesn't return the handle in the hcard --- include/diaspora.php | 5 +++-- mod/xrd.php | 2 +- src/Network/Probe.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index af014c47fe..ecaf28df8c 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1134,7 +1134,8 @@ class Diaspora { return false; // 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); $envelope = fetch_url($source_url); @@ -1150,7 +1151,7 @@ class Diaspora { // This will work for older Diaspora and Friendica servers if (!$x) { - $source_url = $server."/p/".$guid.".xml"; + $source_url = $server."/p/".urlencode($guid).".xml"; logger("Fetch post from ".$source_url, LOGGER_DEBUG); $x = fetch_url($source_url); diff --git a/mod/xrd.php b/mod/xrd.php index a1adc8ac2c..ca6c02b6a2 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -24,7 +24,7 @@ function xrd_init(App $a) { if(substr($uri,0,4) === 'http') { $acct = false; - $name = basename($uri); + $name = ltrim(basename($uri), '~'); } else { $acct = true; $local = str_replace('acct:', '', $uri); diff --git a/src/Network/Probe.php b/src/Network/Probe.php index d27ce18512..30b197f5b6 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -1093,7 +1093,6 @@ class Probe { * @return array Diaspora data */ private static function diaspora($webfinger) { - $hcard_url = ""; $data = array(); foreach ($webfinger["links"] as $link) { @@ -1129,6 +1128,8 @@ class Probe { foreach ($webfinger["aliases"] as $alias) { if (normalise_link($alias) != normalise_link($data["url"]) && ! strstr($alias, "@")) { $data["alias"] = $alias; + } elseif (substr($alias, 0, 5) == 'acct:') { + $data["addr"] = substr($alias, 5); } } }