From 0b4b0de412393001f1854e4be40ebf136959c9f6 Mon Sep 17 00:00:00 2001 From: hannes Date: Tue, 5 Jan 2016 23:14:51 +0000 Subject: [PATCH] longurl in href --- lib/util.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/util.php b/lib/util.php index c03775f577..fd903d5505 100644 --- a/lib/util.php +++ b/lib/util.php @@ -980,10 +980,16 @@ function common_linkify($url) { } else { $canon = File_redirection::_canonUrl($url); $longurl_data = File_redirection::where($canon, common_config('attachments', 'process_links')); - $longurl = $longurl_data->redir_url; + + if(isset($longurl_data->redir_url)) { + $longurl = $longurl_data->redir_url; + } else { + // e.g. local files + $longurl = $longurl_data->url; + } } - - $attrs = array('href' => $canon, 'title' => $longurl); + + $attrs = array('href' => $longurl, 'title' => $longurl); $is_attachment = false; $attachment_id = null;