[Rt-commit] rt branch, 4.6/pjax, updated. rt-4.4.1-15-g6823720

Shawn Moore shawn at bestpractical.com
Thu Dec 1 10:31:57 EST 2016


The branch, 4.6/pjax has been updated
       via  6823720385a9d6ef6ba9ccad045acb0eefdf7cfe (commit)
      from  fe796556a8e2aa13b66762abe6946e48388b7a21 (commit)

Summary of changes:
 share/html/Elements/HeaderJavascript           | 2 +-
 share/html/Elements/ShowTransactionAttachments | 6 +++---
 share/html/Ticket/Elements/ShowAttachments     | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 6823720385a9d6ef6ba9ccad045acb0eefdf7cfe
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Dec 1 15:25:40 2016 +0000

    Avoid pjax rendering attachments inside the browser
    
    Without this, even binary attachments will render inside the browser. We
    force the browser to use an ordinary page load by adding a new
    .skip-pjax class, causing the browser to initiate a file download.
    
    Fixes: T#176836

diff --git a/share/html/Elements/HeaderJavascript b/share/html/Elements/HeaderJavascript
index bc1a9b2..c4f2c9e 100644
--- a/share/html/Elements/HeaderJavascript
+++ b/share/html/Elements/HeaderJavascript
@@ -64,7 +64,7 @@ jQuery( loadTitleBoxStates );
     jQuery( <% $onload |n %> );
 % }
 % if ( RT->Config->Get('EnablePjax') ) {
-jQuery(document).pjax('a', 'body', { timeout: 30000 });
+jQuery(document).pjax('a:not(.skip-pjax)', 'body', { timeout: 30000 });
 % }
 --></script>
 <%INIT>
diff --git a/share/html/Elements/ShowTransactionAttachments b/share/html/Elements/ShowTransactionAttachments
index 34a6ad1..b2cccbb 100644
--- a/share/html/Elements/ShowTransactionAttachments
+++ b/share/html/Elements/ShowTransactionAttachments
@@ -64,13 +64,13 @@ foreach my $message ( @{ $Attachments->{ $Parent || 0 } || [] } ) {
 </%PERL>
 <div class="downloadattachment">
 % if (my $url = RT->System->ExternalStorageURLFor($message)) {
-<a href="<% $url %>">
+<a class="skip-pjax" href="<% $url %>">
 % } else {
-<a href="<% $AttachmentPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% $name | un %>">
+<a class="skip-pjax" href="<% $AttachmentPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% $name | un %>">
 % }
 <&|/l&>Download</&> <% length $name ? $name : loc('(untitled)') %></a>\
 % if ( $DownloadableHeaders && ! length $name && $message->ContentType =~ /text/  ) {
- / <a href="<% $AttachmentPath %>/WithHeaders/<% $message->Id %>"><% loc('with headers') %></a>
+ / <a class="skip-pjax" href="<% $AttachmentPath %>/WithHeaders/<% $message->Id %>"><% loc('with headers') %></a>
 % }
 % $m->callback(CallbackName => 'AfterDownloadLinks', ARGSRef => \%ARGS, Object => $Object, Transaction => $Transaction, Attachment => $message);
 <br />
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index a13c9be..88dec33 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -68,9 +68,9 @@
 % }
 
 % if (my $url = RT->System->ExternalStorageURLFor($rev)) {
-<a href="<%$url%>">
+<a class="skip-pjax" href="<%$url%>">
 % } else {
-<a href="<%RT->Config->Get('WebPath')%>/<% $DisplayPath %>/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | un %>">
+<a class="skip-pjax" href="<%RT->Config->Get('WebPath')%>/<% $DisplayPath %>/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | un %>">
 % }
 % my $desc = loc("[_1] ([_2]) by [_3]", $rev->CreatedAsString, $rev->FriendlyContentLength, $m->scomp('/Elements/ShowUser', User => $rev->CreatorObj));
 <% $desc |n%>

-----------------------------------------------------------------------


More information about the rt-commit mailing list