From 8ed6469fb96fcd68fb3e7008a6d42dc6ee4337dc Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 27 Sep 2021 20:29:11 +0000 Subject: [PATCH 1/2] Issue 10772: Avoid duplicated links to Twitter --- twitter/twitter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 45f8fe131..66eb315a6 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -680,7 +680,7 @@ function twitter_post_hook(App $a, array &$b) } // Add the link to the body if the type isn't a photo or there are more than 4 images in the post - if (!empty($msgarr['url']) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { + if ((strpos($msg, $msgarr['url']) === false) && !empty($msgarr['url']) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { $msg .= "\n" . $msgarr['url']; } From eed987f9e15eaa82f19e426b8d9a7b1f41573622 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 28 Sep 2021 05:22:01 +0200 Subject: [PATCH 2/2] Update twitter/twitter.php Co-authored-by: Hypolite Petovan --- twitter/twitter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 66eb315a6..912903e42 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -680,7 +680,7 @@ function twitter_post_hook(App $a, array &$b) } // Add the link to the body if the type isn't a photo or there are more than 4 images in the post - if ((strpos($msg, $msgarr['url']) === false) && !empty($msgarr['url']) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { + if (!empty($msgarr['url']) && (strpos($msg, $msgarr['url']) === false) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { $msg .= "\n" . $msgarr['url']; }