summaryrefslogtreecommitdiff
path: root/plugins/BitlyUrl
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-11-30 16:34:52 -0800
committerBrion Vibber <brion@pobox.com>2010-11-30 16:34:52 -0800
commit749367e12f9742d7fd5ee028230fefa627599125 (patch)
treeb52d7de6bb389fdc5a0e631d8022f409c2908d21 /plugins/BitlyUrl
parent6bdce2b1e5f7250e5309048cfb64eeefa770f3bb (diff)
parentb4fc54c308936477706acb5cc3c4acae4c3f3a4d (diff)
Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
Conflicts: lib/router.php
Diffstat (limited to 'plugins/BitlyUrl')
-rw-r--r--plugins/BitlyUrl/BitlyUrlPlugin.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/BitlyUrl/BitlyUrlPlugin.php b/plugins/BitlyUrl/BitlyUrlPlugin.php
index 93a35b3f3..b4f80a50a 100644
--- a/plugins/BitlyUrl/BitlyUrlPlugin.php
+++ b/plugins/BitlyUrl/BitlyUrlPlugin.php
@@ -118,7 +118,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);
@@ -145,6 +145,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;