projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
73641bb
)
fix firefox attachment downloads with spaces, RT#30167
author
Ivan Kohler
<ivan@freeside.biz>
Sat, 26 Jul 2014 23:56:05 +0000
(16:56 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Sat, 26 Jul 2014 23:56:05 +0000
(16:56 -0700)
httemplate/view/attachment.html
patch
|
blob
|
history
diff --git
a/httemplate/view/attachment.html
b/httemplate/view/attachment.html
index
5827e3d
..
4c4ca56
100644
(file)
--- a/
httemplate/view/attachment.html
+++ b/
httemplate/view/attachment.html
@@
-1,15
+1,26
@@
<%init>
<%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';
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
die 'access denied' if $attach->disabled;
$r->subprocess_env('no-gzip' => 1); # disable mod_deflate
+
$m->clear_buffer;
$m->clear_buffer;
+
$r->content_type($attach->mime_type || 'text/plain');
$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);
$m->print($attach->body);
+
</%init>
</%init>