From 14de4f7cc44ebf65b4e68c95c3638c3e9d94df7c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 19 Aug 2013 11:19:00 +0200 Subject: [PATCH] Form::parse_template: "Content-disposition: attachment"-Header nur ausgeben, wenn Attachmentname bekannt Fixt #2351. --- SL/Form.pm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index f0d13de04..5fd0e687d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1156,16 +1156,22 @@ sub parse_template { seek IN, 0, 0; } else { - $self->{attachment_filename} = ($self->{attachment_filename}) - ? $self->{attachment_filename} - : $self->generate_attachment_filename(); - - # launch application - print qq|Content-Type: | . $template->get_mime_type() . qq| -Content-Disposition: attachment; filename="$self->{attachment_filename}" -Content-Length: $numbytes + my %headers = ('-type' => $template->get_mime_type, + '-connection' => 'close', + '-charset' => 'UTF-8'); + + $self->{attachment_filename} ||= $self->generate_attachment_filename; + + if ($self->{attachment_filename}) { + %headers = ( + %headers, + '-attachment' => $self->{attachment_filename}, + '-content-length' => $numbytes, + '-charset' => '', + ); + } -|; + print $::request->cgi->header(%headers); $::locale->with_raw_io(\*STDOUT, sub { print while }); } -- 2.20.1