[freeside-commits] branch FREESIDE_3_BRANCH updated. df2a87672acaed825b7399bf909a69314bb0d9c0

Ivan ivan at 420.am
Sat Jul 26 16:56:07 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  df2a87672acaed825b7399bf909a69314bb0d9c0 (commit)
      from  40ae0a48812971c84c4bc90e21d8cfb04155a96c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit df2a87672acaed825b7399bf909a69314bb0d9c0
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jul 26 16:56:06 2014 -0700

    fix firefox attachment downloads with spaces, RT#30167

diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html
index 5827e3d..4c4ca56 100644
--- a/httemplate/view/attachment.html
+++ b/httemplate/view/attachment.html
@@ -1,15 +1,26 @@
 <%init>
+$FS::CurrentUser::CurrentUser->access_right('Download attachment')
+  or die 'access denied';
+
 my ($query) = $cgi->keywords;
 $query =~ /^(\d+)$/;
 my $attachnum = $1 or die 'Invalid attachment number';
-$FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
-
-my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
+my $attach = qsearchs('cust_attachment', { attachnum => $attachnum })
+  or die "Attachment not found: $attachnum";
 die 'access denied' if $attach->disabled;
 
 $r->subprocess_env('no-gzip' => 1); # disable mod_deflate
+
 $m->clear_buffer;
+
 $r->content_type($attach->mime_type || 'text/plain');
-$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
+
+my $filename = $attach->filename;
+$filename =~ s/"/'/g; #no idea how to encode " ... \" ?  "" ?  can't?
+$r->headers_out->add(
+  'Content-Disposition' => qq(attachment;filename="$filename")
+);
+
 $m->print($attach->body);
+
 </%init>

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

Summary of changes:
 httemplate/view/attachment.html |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list