Replace parse_url with UriInterface instantiation in Model\APContact
- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1338133783
This commit is contained in:
parent
b29e520a25
commit
e7574356d8
|
@ -291,14 +291,11 @@ class APContact
|
||||||
return $fetched_contact;
|
return $fetched_contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = parse_url($apcontact['url']);
|
|
||||||
unset($parts['scheme']);
|
|
||||||
unset($parts['path']);
|
|
||||||
|
|
||||||
if (empty($apcontact['addr'])) {
|
if (empty($apcontact['addr'])) {
|
||||||
if (!empty($apcontact['nick']) && is_array($parts)) {
|
try {
|
||||||
$apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
|
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
|
||||||
} else {
|
} catch (\Throwable $e) {
|
||||||
|
Logger::warning('Unable to coerce APContact URL into a UriInterface object', ['url' => $apcontact['url'], 'error' => $e->getMessage()]);
|
||||||
$apcontact['addr'] = '';
|
$apcontact['addr'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user