Merge pull request #8147 from annando/fetch-post
Fix for AP posts where the URL don't match
This commit is contained in:
commit
ae2959c780
|
@ -3759,8 +3759,8 @@ class Item
|
||||||
return $item_id;
|
return $item_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActivityPub\Processor::fetchMissingActivity($uri)) {
|
if ($fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri)) {
|
||||||
$item_id = self::searchByLink($uri, $uid);
|
$item_id = self::searchByLink($fetched_uri, $uid);
|
||||||
} else {
|
} else {
|
||||||
$item_id = Diaspora::fetchByURL($uri);
|
$item_id = Diaspora::fetchByURL($uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -591,7 +591,7 @@ class Processor
|
||||||
*
|
*
|
||||||
* @param string $url message URL
|
* @param string $url message URL
|
||||||
* @param array $child activity array with the child of this message
|
* @param array $child activity array with the child of this message
|
||||||
* @return boolean success
|
* @return string fetched message URL
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function fetchMissingActivity($url, $child = [])
|
public static function fetchMissingActivity($url, $child = [])
|
||||||
|
@ -605,12 +605,12 @@ class Processor
|
||||||
$object = ActivityPub::fetchContent($url, $uid);
|
$object = ActivityPub::fetchContent($url, $uid);
|
||||||
if (empty($object)) {
|
if (empty($object)) {
|
||||||
Logger::log('Activity ' . $url . ' was not fetchable, aborting.');
|
Logger::log('Activity ' . $url . ' was not fetchable, aborting.');
|
||||||
return false;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($object['id'])) {
|
if (empty($object['id'])) {
|
||||||
Logger::log('Activity ' . $url . ' has got not id, aborting. ' . json_encode($object));
|
Logger::log('Activity ' . $url . ' has got not id, aborting. ' . json_encode($object));
|
||||||
return false;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($child['author'])) {
|
if (!empty($child['author'])) {
|
||||||
|
@ -648,9 +648,9 @@ class Processor
|
||||||
$ldactivity['thread-completion'] = true;
|
$ldactivity['thread-completion'] = true;
|
||||||
|
|
||||||
ActivityPub\Receiver::processActivity($ldactivity);
|
ActivityPub\Receiver::processActivity($ldactivity);
|
||||||
Logger::log('Activity ' . $url . ' had been fetched and processed.');
|
Logger::notice('Activity had been fetched and processed.', ['url' => $url, 'object' => $activity['id']]);
|
||||||
|
|
||||||
return true;
|
return $activity['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue