From: Hypolite Petovan Date: Tue, 23 Nov 2021 22:51:12 +0000 (-0500) Subject: [twitter] Improve probe_detect hook function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2f2b75ba5015d05279f291f110f2781800938d34;p=friendica-addons.git [twitter] Improve probe_detect hook function - Prevent tweet URLs to be considered as contact URLs --- diff --git a/twitter/twitter.php b/twitter/twitter.php index 8b7451b8..f31efe97 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -482,7 +482,7 @@ function twitter_post_local(App $a, array &$b) function twitter_probe_detect(App $a, array &$hookData) { // Don't overwrite an existing result - if ($hookData['result']) { + if (isset($hookData['result'])) { return; } @@ -494,6 +494,13 @@ function twitter_probe_detect(App $a, array &$hookData) if (preg_match('=([^@]+)@(?:mobile\.)?twitter\.com$=i', $hookData['uri'], $matches)) { $nick = $matches[1]; } elseif (preg_match('=^https?://(?:mobile\.)?twitter\.com/(.+)=i', $hookData['uri'], $matches)) { + if (strpos($matches[1], '/') !== false) { + // Status case: https://twitter.com//status/ + // Not a contact + $hookData['result'] = false; + return; + } + $nick = $matches[1]; } else { return;