From 9a270de9c2de6a93fe081a2c0d8d83de6b6a82b3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 29 Jan 2023 00:11:13 -0500 Subject: [PATCH 1/2] Prevent the use of $shared_item if it's falsy in Mastodon\Status::createQuote - Address https://github.com/friendica/friendica/issues/12488#issuecomment-1407342324 --- src/Factory/Api/Mastodon/Status.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index acc7afeb5..9f6d3bcde 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -285,8 +285,7 @@ class Status extends BaseFactory { if (empty($item['quote-uri-id'])) { $media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]); - if (!empty($media)) { - $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]]); + if (!empty($media) && $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]])) { $quote_id = $shared_item['uri-id']; } } else { From 48a7958ef9e9246dc75342030a1347fb22fe19d1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 29 Jan 2023 00:12:59 -0500 Subject: [PATCH 2/2] Check $url variable for value before using it in Module\Photo::getPhotoById - Address https://github.com/friendica/friendica/issues/12488#issuecomment-1407342540 --- src/Module/Photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Photo.php b/src/Module/Photo.php index bb7ee6029..7a952de40 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -351,7 +351,7 @@ class Photo extends BaseModule } // If it is a local link, we save resources by just redirecting to it. - if (Network::isLocalLink($url)) { + if (!empty($url) && Network::isLocalLink($url)) { System::externalRedirect($url); }