From: Moritz Bunkus Date: Mon, 19 Aug 2013 09:19:00 +0000 (+0200) Subject: Form::parse_template: "Content-disposition: attachment"-Header nur ausgeben, wenn... X-Git-Tag: release-3.1.0beta1~81 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=14de4f7cc44ebf65b4e68c95c3638c3e9d94df7c;p=kivitendo-erp.git Form::parse_template: "Content-disposition: attachment"-Header nur ausgeben, wenn Attachmentname bekannt Fixt #2351. --- 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 }); }