[Catalyst] Re: generating and redirecting to pdfs

Aristotle Pagaltzis pagaltzis at gmx.de
Sat Oct 24 14:49:33 GMT 2009


* Jason Galea <lists at eightdegrees.com.au> [2009-10-21 01:50]:
>   $c->res->header( 'Content-Disposition' => 'attachment;filename='.$c->stash->{pdf_filename} );

This will break for filenames with spaces in them. For strict
correctness, you want this:

    ( my $pdf_filename = $c->stash->{ pdf_filename } ) =~ s!"!\\"!g;
    $c->res->header( 'Content-Disposition' => qq(attachment; filename="$pdf_filename") );

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list