summaryrefslogtreecommitdiff
path: root/classes/File.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-09-27 16:52:15 -0400
committerCraig Andrews <candrews@integralblue.com>2009-09-27 16:52:15 -0400
commitfc2426d7ce33bba0e1ad4dfc1ed9af7749695b20 (patch)
tree4a6b9cf632e10f8b947a4d8b9be56a1c69d46674 /classes/File.php
parent7f3c1ac2beca8f0e21c002930a5df6dc2d9415ad (diff)
Fix some bugs in the URL linkification, and fixed the unit test.
Diffstat (limited to 'classes/File.php')
-rw-r--r--classes/File.php8
1 files changed, 7 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);