From 5b940f255fd78492ba6dbe0dd4dd71266428f08b Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 19 Feb 2015 19:12:16 +0100 Subject: [PATCH] Mediafile updated to insert urlhash and lookup properly --- lib/mediafile.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mediafile.php b/lib/mediafile.php index f18a557fa4..131cc7dd17 100644 --- a/lib/mediafile.php +++ b/lib/mediafile.php @@ -141,10 +141,11 @@ class MediaFile function maybeAddRedir($file_id, $url) { - $file_redir = File_redirection::getKV('url', $url); - - if (!$file_redir instanceof File_redirection) { + try { + $file_redir = File_redirection::getByUrl($url); + } catch (NoResultException $e) { $file_redir = new File_redirection; + $file_redir->urlhash = File::hashurl($url); $file_redir->url = $url; $file_redir->file_id = $file_id;