Merge pull request #10631 from MrPetovan/bug/10625-guzzleresponse-body-stream
Allow a GuzzleResponse body to be queried more than once
This commit is contained in:
commit
73e8db24f9
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue