This should display link attachments now.

This commit is contained in:
Mike Macgirvin 2024-08-31 08:17:04 +10:00
parent 27ac124c59
commit 875b877763

View file

@ -4839,8 +4839,7 @@ class Activity
if (array_key_exists('type', $a) && stripos($a['type'], 'video') !== false) {
if (self::media_not_in_body($a['href'], $item['body'])) {
if (isset($a['name']) && $a['name']) {
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
$alt = str_replace(['[', ']'], ['[', ']'], $alt);
$alt = str_replace(['[', ']', '\\"', '\"', '"', '"'], ['[', ']', '"', '"', '"', '"'], $a['name']); $alt = htmlspecialchars($alt, ENT_QUOTES, 'UTF-8', false);
$item['body'] .= "\n\n" . '[video title="' . $alt . '"]' . $a['href'] . '[/video]';
} else {
$item['body'] .= "\n\n" . '[video]' . $a['href'] . '[/video]';
@ -4852,7 +4851,7 @@ class Activity
$item['body'] .= "\n\n" . '[audio]' . $a['href'] . '[/audio]';
}
}
if (!isset($a['type']) && ActivityStreams::is_url($a['href']) && !strpos($item['body'], $a['href'])) {
if ((!isset($a['type']) || $a['type'] === 'Link') && ActivityStreams::is_url($a['href']) && !strpos($item['body'], $a['href'])) {
$li = Url::get(z_root() . '/linkinfo?binurl=' . bin2hex($a['href']));
if ($li['success'] && $li['body']) {
$item['body'] .= "\n" . $li['body'];