Ensure url property of Probe::uri result is used authoritatively

- Some profile URLs aren't canonical and need to be updated during probe
This commit is contained in:
Hypolite Petovan 2020-06-24 20:57:47 -04:00
commit 50d05cec83
8 changed files with 16 additions and 20 deletions

View file

@ -297,8 +297,8 @@ function dfrn_request_post(App $a)
$data = Probe::uri($url);
$network = $data["network"];
// Canonicalise email-style profile locator
$url = Probe::webfingerDfrn($url, $hcard);
// Canonicalize email-style profile locator
$url = Probe::webfingerDfrn($data['url'], $hcard);
if (substr($url, 0, 5) === 'stat:') {
// Every time we detect the remote subscription we define this as OStatus.

View file

@ -129,7 +129,7 @@ function follow_content(App $a)
if ($protocol == Protocol::PHANTOM) {
// Possibly it is a remote item and not an account
follow_remote_item($url);
follow_remote_item($ret['url']);
notice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
$submit = '';

View file

@ -48,7 +48,6 @@ function ostatus_subscribe_content(App $a)
}
$contact = Probe::uri($_REQUEST['url']);
if (!$contact) {
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
return $o . DI::l10n()->t('Couldn\'t fetch information for contact.');
@ -91,7 +90,7 @@ function ostatus_subscribe_content(App $a)
$probed = Probe::uri($url);
if ($probed['network'] == Protocol::OSTATUS) {
$result = Contact::createFromProbe($a->user, $url, true, Protocol::OSTATUS);
$result = Contact::createFromProbe($a->user, $probed['url'], true, Protocol::OSTATUS);
if ($result['success']) {
$o .= ' - ' . DI::l10n()->t('success');
} else {