From: Mikael Nordfeldth Date: Thu, 19 Feb 2015 18:12:16 +0000 (+0100) Subject: Mediafile updated to insert urlhash and lookup properly X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5b940f255fd78492ba6dbe0dd4dd71266428f08b;p=quix0rs-gnu-social.git Mediafile updated to insert urlhash and lookup properly --- 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;