diff --git a/mod/follow.php b/mod/follow.php index 075e58d09..09201bed1 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -60,8 +60,7 @@ function follow_content(App $a) $uid = local_user(); - // Issue 4815: Silently removing a prefixing @ - $url = ltrim(Strings::escapeTags(trim($_REQUEST['url'] ?? '')), '@!'); + $url = Probe::cleanURI(trim($_REQUEST['url'] ?? '')); // Issue 6874: Allow remote following from Peertube if (strpos($url, 'acct:') === 0) { diff --git a/src/Console/Contact.php b/src/Console/Contact.php index ba65c0025..9dfcf1392 100644 --- a/src/Console/Contact.php +++ b/src/Console/Contact.php @@ -25,6 +25,7 @@ use Console_Table; use Friendica\App; use Friendica\Model\Contact as ContactModel; use Friendica\Model\User as UserModel; +use Friendica\Network\Probe; use Friendica\Util\Temporal; use RuntimeException; use Seld\CliPrompt\CliPrompt; @@ -153,6 +154,8 @@ HELP; } } + $url = Probe::cleanURI($url); + $contact = ContactModel::getByURLForUser($url, $user['uid']); if (!empty($contact)) { throw new RuntimeException('Contact already exists'); diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php index 86aa4afd1..6c2891c0b 100644 --- a/src/Module/Debug/Probe.php +++ b/src/Module/Debug/Probe.php @@ -44,6 +44,7 @@ class Probe extends BaseModule $res = ''; if (!empty($addr)) { + $addr = NetworkProbe::cleanURI($addr); $res = NetworkProbe::uri($addr, '', 0); $res = print_r($res, true); } diff --git a/src/Network/GuzzleResponse.php b/src/Network/GuzzleResponse.php index b68f2e843..3b41f6f65 100644 --- a/src/Network/GuzzleResponse.php +++ b/src/Network/GuzzleResponse.php @@ -147,8 +147,8 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface } /// @todo - fix mismatching use of "getBody()" as string here and parent "getBody()" as streaminterface - public function getBody() + public function getBody(): string { - return parent::getBody()->getContents(); + return (string) parent::getBody(); } }