From: Mikael Nordfeldth <mmn@hethane.se>
Date: Thu, 7 Jan 2016 17:13:10 +0000 (+0100)
Subject: Use index for File url (urlhash)
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=be58fd64f577d274a50ab622ce65cb446177b51d;p=quix0rs-gnu-social.git

Use index for File url (urlhash)
---

diff --git a/lib/util.php b/lib/util.php
index fd903d5505..30ad757f75 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -997,9 +997,9 @@ function common_linkify($url) {
 
     // Check to see whether this is a known "attachment" URL.
 
-    $f = File::getKV('url', $longurl);
-
-    if (!$f instanceof File) {
+    try {
+        $f = File::getByUrl($longurl);
+    } catch (NoResultException $e) {
         if (common_config('attachments', 'process_links')) {
             // XXX: this writes to the database. :<
             try {
@@ -2436,4 +2436,4 @@ function html_sprintf()
         $args[$i] = htmlspecialchars($args[$i]);
     }
     return call_user_func_array('sprintf', $args);
-}
\ No newline at end of file
+}