From 0c17c322676d98d3a8bb6698818e0eefa556b917 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 21 Feb 2016 18:48:48 +0100 Subject: [PATCH] Let the WebFingerPlugin lookup profile resources with index.php/ too --- plugins/WebFinger/WebFingerPlugin.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/WebFinger/WebFingerPlugin.php b/plugins/WebFinger/WebFingerPlugin.php index 1677501a20..84d2f63b6c 100644 --- a/plugins/WebFinger/WebFingerPlugin.php +++ b/plugins/WebFinger/WebFingerPlugin.php @@ -100,12 +100,21 @@ class WebFingerPlugin extends Plugin } } } else { - $user = User::getKV('uri', $resource); - if ($user instanceof User) { + try { + $user = User::getByUri($resource); $profile = $user->getProfile(); - } else { - // try and get it by profile url - $profile = Profile::getKV('profileurl', $resource); + } catch (NoResultException $e) { + try { + // common_fake_local_fancy_url can throw an exception + $fancy_url = common_fake_local_fancy_url($resource); + + // and this will throw a NoResultException if not found + $user = User::getByUri($fancy_url); + $profile = $user->getProfile(); + } catch (Exception $e) { + // if our rewrite hack didn't work, try to get something by profile URL + $profile = Profile::getKV('profileurl', $resource); + } } } -- 2.39.5