1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-01 14:20:16 +02:00

refactor: FeedItem::setTimestamp() (#3711)

This commit is contained in:
Dag
2023-09-26 00:27:45 +02:00
committed by GitHub
parent f421c45b21
commit ae53adefad
5 changed files with 38 additions and 15 deletions

View File

@@ -161,8 +161,8 @@ class MastodonBridge extends BridgeAbstract
$object = $this->fetchAP($object);
}
$item['content'] = $object['content'];
$strippedContent = strip_tags(str_replace('<br>', ' ', $object['content']));
$item['content'] = $object['content'] ?? '';
$strippedContent = strip_tags(str_replace('<br>', ' ', $item['content']));
if (isset($object['name'])) {
$item['title'] = $object['name'];
@@ -186,9 +186,10 @@ class MastodonBridge extends BridgeAbstract
foreach ($object['attachment'] as $attachment) {
// Only process REMOTE pictures (prevent xss)
$mediaType = $attachment['mediaType'] ?? null;
if (
$attachment['mediaType']
&& preg_match('/^image\//', $attachment['mediaType'], $match)
$mediaType
&& preg_match('/^image\//', $mediaType, $match)
&& preg_match('/^http(s|):\/\//', $attachment['url'], $match)
) {
$item['content'] = $item['content'] . '<br /><img ';