]> git.mxchange.org Git - friendica.git/commitdiff
Fix URI structure condition in Probe::detect
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 2 Dec 2021 12:54:48 +0000 (07:54 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 3 Dec 2021 22:39:35 +0000 (17:39 -0500)
- This condition was wrongly discarding all URIs with a schemes

src/Network/Probe.php

index baae0d3d310d989bd2faa99e9772ab49a2e3fcb7..bcbadd82f06595cb0b54c20743db8b438b3650e5 100644 (file)
@@ -686,22 +686,21 @@ class Probe
                }
 
                $parts = parse_url($uri);
-
-               if (empty($parts['scheme']) || !empty($parts['host']) && strstr($uri, '@')) {
-                       // If the URI starts with "mailto:" then jump directly to the mail detection
-                       if (strpos($uri, 'mailto:') !== false) {
-                               $uri = str_replace('mailto:', '', $uri);
-                               return self::mail($uri, $uid);
-                       }
-
-                       if ($network == Protocol::MAIL) {
-                               return self::mail($uri, $uid);
-                       }
-               } else {
+               if (empty($parts['scheme']) && empty($parts['host']) && !strstr($parts['path'], '@')) {
                        Logger::info('URI was not detectable', ['uri' => $uri]);
                        return [];
                }
 
+               // If the URI starts with "mailto:" then jump directly to the mail detection
+               if (strpos($uri, 'mailto:') !== false) {
+                       $uri = str_replace('mailto:', '', $uri);
+                       return self::mail($uri, $uid);
+               }
+
+               if ($network == Protocol::MAIL) {
+                       return self::mail($uri, $uid);
+               }
+
                Logger::info('Probing start', ['uri' => $uri]);
 
                if (!empty($ap_profile['addr']) && ($ap_profile['addr'] != $uri)) {