From d7f62e82b96d0980e6e54fa8a1899f208b520a8b Mon Sep 17 00:00:00 2001
From: Hypolite Petovan <mrpetovan@gmail.com>
Date: Tue, 7 Mar 2017 16:28:15 -0500
Subject: [PATCH] Fix behavior regression
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Reverted quitting get_contact if Probe::uri didn’t yield an url for
“nick@server.tld” form.
---
 include/Contact.php | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/Contact.php b/include/Contact.php
index 1fcdc6951c..5b0599449f 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -577,11 +577,6 @@ function get_contact($url, $uid = 0, $no_update = false) {
 
 	require_once('include/Probe.php');
 	$data = Probe::uri($url);
-	if (!$data['url']) {
-		return 0;
-	}
-
-	$url = $data["url"];
 
 	// Does this address belongs to a valid network?
 	if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
@@ -599,6 +594,12 @@ function get_contact($url, $uid = 0, $no_update = false) {
 		$data = $gcontacts[0];
 	}
 
+	// Unable to convert nick@server.tld into http://server.tld/nick
+	if (!$data['url'] && (!strstr($url, "http") OR strstr($url, "@"))) {
+		return 0;
+	}
+
+	$url = $data["url"];
 
 	if (!$contact_id) {
 		q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
-- 
2.39.5