From: Frédéric Buclin Date: Sun, 18 Jul 2010 22:44:55 +0000 (+0200) Subject: Bug 579749: Linkify the URL found in attachments (restore the is_url behavior) if... X-Git-Tag: bugzilla-4.1.1~369 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ba10751a624a0b94d01aa66c9747fe81cba3e39;p=thirdparty%2Fbugzilla.git Bug 579749: Linkify the URL found in attachments (restore the is_url behavior) if there is only an URL in them r/a=LpSolit --- diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index d1861a7d3e..b9e2497fd5 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -172,7 +172,7 @@

[% ELSIF attachment.is_viewable %] -
+
[% INCLUDE global/textarea.html.tmpl id = 'editFrame' name = 'comment' @@ -183,10 +183,27 @@ defaultcontent = (attachment.contenttype.match('^text\/')) ? attachment.data.replace('(.*\n|.+)', '>$1') : undef %] - + [%# The regexp is stolen from quoteUrls(), see Template.pm %] + [% safe_protocols = constants.SAFE_PROTOCOLS.join('|') %] + [% IF attachment.contenttype == 'text/plain' + && attachment.data.match("^($safe_protocols):" _ '[^\s<>\"]+[\w\/]$') %] +

+ + [% IF attachment.datasize < 120 %] + [% attachment.data FILTER html %] + [% ELSE %] + [% attachment.data FILTER truncate(80) FILTER html %] + ... + [% attachment.data.match('.*(.{20})$').0 FILTER html %] + [% END %] + +

+ [% ELSE %] + + [% END %]