forked from friendica/friendica-addons
Merge pull request #1163 from nupplaphil/bug/http_client
[statusnet] Catch TransferExceptions for HTTPClient::finalUrl()
This commit is contained in:
commit
3d7a4c9326
|
@ -58,6 +58,7 @@ use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
use GuzzleHttp\Exception\TransferException;
|
||||||
|
|
||||||
function statusnet_install()
|
function statusnet_install()
|
||||||
{
|
{
|
||||||
|
@ -1426,7 +1427,12 @@ function statusnet_convertmsg(App $a, $body)
|
||||||
|
|
||||||
Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG);
|
Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG);
|
||||||
|
|
||||||
|
try {
|
||||||
$expanded_url = DI::httpClient()->finalUrl($match[1]);
|
$expanded_url = DI::httpClient()->finalUrl($match[1]);
|
||||||
|
} catch (TransferException $exception) {
|
||||||
|
Logger::notice('statusnet_convertmsg: Couldn\'t get final URL.', ['url' => $match[1], 'exception' => $exception]);
|
||||||
|
$expanded_url = $match[1];
|
||||||
|
}
|
||||||
|
|
||||||
Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG);
|
Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue