X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FBitlyUrl%2FBitlyUrlPlugin.php;h=532e66fbc73d2ec7bb06ddce6d6d3e2e672d053d;hb=f82dd4e14f8e4797f2a14cf10527bb71bc224b72;hp=f4d987489ab0a6509a3ec1b2f1b83f692fa2bd29;hpb=04ca706601a2a3b556cc52fa21b61fcd842c4e87;p=quix0rs-gnu-social.git diff --git a/plugins/BitlyUrl/BitlyUrlPlugin.php b/plugins/BitlyUrl/BitlyUrlPlugin.php index f4d987489a..532e66fbc7 100644 --- a/plugins/BitlyUrl/BitlyUrlPlugin.php +++ b/plugins/BitlyUrl/BitlyUrlPlugin.php @@ -116,7 +116,7 @@ class BitlyUrlPlugin extends UrlShortenerPlugin $params = http_build_query(array( 'login' => $this->getLogin(), 'apiKey' => $this->getApiKey()), '', '&'); - $serviceUrl = sprintf($this->serviceUrl, $url) . '&' . $params; + $serviceUrl = sprintf($this->serviceUrl, urlencode($url)) . '&' . $params; $request = HTTPClient::start(); return $request->get($serviceUrl); @@ -143,6 +143,10 @@ class BitlyUrlPlugin extends UrlShortenerPlugin common_log(LOG_INFO, $body); $json = json_decode($body, true); if ($json['statusCode'] == 'OK') { + if (!isset($json['results'][$url])) { + common_log(LOG_ERR, "bit.ly returned OK response, but didn't find expected URL $url in $body"); + return false; + } $data = $json['results'][$url]; if (isset($data['shortUrl'])) { return true;