From 87462ec67f5464a7ab6f4d25ea0d484f344cbdac Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 Sep 2019 21:44:37 +0000 Subject: [PATCH 1/2] Don't use the "url" parameter on redir if it points to the same contact --- src/Model/Contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 798c9cd209..1e3d0b9154 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1193,7 +1193,7 @@ class Contact extends BaseObject $sparkle = false; if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { $sparkle = true; - $profile_link = System::baseUrl() . '/redir/' . $contact['id'] . '?url=' . $contact['url']; + $profile_link = System::baseUrl() . '/redir/' . $contact['id']; } else { $profile_link = $contact['url']; } @@ -2744,7 +2744,7 @@ class Contact extends BaseObject $redirect = 'redir/' . $contact['id']; - if ($url != '') { + if (($url != '') && !Strings::compareLink($contact['url'], $url)) { $redirect .= '?url=' . $url; } From 08f30e1769e0812398f0d6a82d0d43202ea5d035 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 Sep 2019 21:51:08 +0000 Subject: [PATCH 2/2] Fix notice --- mod/redir.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod/redir.php b/mod/redir.php index 7c93c9f39a..1df7060fa6 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -148,7 +148,8 @@ function redir_magic($a, $cid, $url) Logger::info('Got my url', ['visitor' => $visitor]); } - if (empty(visitor) && remote_user()) { + /// @todo Most likely these lines are superfluous. We will remove them in the next version + if (empty($visitor) && remote_user()) { $contact = DBA::selectFirst('contact', ['url'], ['id' => remote_user()]); if (!empty($contact['url'])) { $visitor = $contact['url']; @@ -156,7 +157,7 @@ function redir_magic($a, $cid, $url) } } - if (empty(visitor) && local_user()) { + if (empty($visitor) && local_user()) { $contact = DBA::selectFirst('contact', ['url'], ['id' => local_user()]); if (!empty($contact['url'])) { $visitor = $contact['url'];