mirror of
https://github.com/friendica/friendica
synced 2025-04-25 01:10:12 +00:00
Avoid exception "Unable to retrieve the host in URL" in the search
This commit is contained in:
parent
c71f4eb1df
commit
0d4f956fba
2 changed files with 30 additions and 25 deletions
|
@ -4132,9 +4132,14 @@ class Item
|
|||
return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS]);
|
||||
if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) {
|
||||
$fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid);
|
||||
try {
|
||||
$curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS]);
|
||||
if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) {
|
||||
$fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
Logger::info('Invalid link', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!empty($fetched_uri)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue