summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-27 21:15:14 -0400
committerEvan Prodromou <evan@status.net>2009-09-27 21:15:14 -0400
commit3afcdc18f7bfd23ac780b9f27c47582c1b41bb83 (patch)
tree289e54a747c8b67d5455e85d64045aa7dfb1d54b /classes
parentee9856c452a7e54994c30cd9138dd6faa2107001 (diff)
parentfc2426d7ce33bba0e1ad4dfc1ed9af7749695b20 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r--classes/File.php8
-rw-r--r--classes/File_redirection.php3
2 files changed, 10 insertions, 1 deletions
diff --git a/classes/File.php b/classes/File.php
index 9758cf7f5..e04a9d525 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -94,7 +94,13 @@ class File extends Memcached_DataObject
$file_redir = File_redirection::staticGet('url', $given_url);
if (empty($file_redir)) {
$redir_data = File_redirection::where($given_url);
- $redir_url = $redir_data['url'];
+ if (is_array($redir_data)) {
+ $redir_url = $redir_data['url'];
+ } elseif (is_string($redir_data)) {
+ $redir_url = $redir_data;
+ } else {
+ throw new ServerException("Can't process url '$given_url'");
+ }
// TODO: max field length
if ($redir_url === $given_url || strlen($redir_url) > 255) {
$x = File::saveNew($redir_data, $given_url);
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
index 76b18f672..79052bf7d 100644
--- a/classes/File_redirection.php
+++ b/classes/File_redirection.php
@@ -79,6 +79,9 @@ class File_redirection extends Memcached_DataObject
}
}
+ if(strpos($short_url,'://') === false){
+ return $short_url;
+ }
$curlh = File_redirection::_commonCurl($short_url, $redirs);
// Don't include body in output
curl_setopt($curlh, CURLOPT_NOBODY, true);