[Catalyst] Re: generating and redirecting to pdfs

Aristotle Pagaltzis pagaltzis at gmx.de
Tue Oct 27 09:40:48 GMT 2009


* Jason Galea <lists at eightdegrees.com.au> [2009-10-26 23:45]:
> On Sun, Oct 25, 2009 at 12:49 AM, Aristotle Pagaltzis <pagaltzis at gmx.de>wrote:
> > * 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") );
                                                                         ^             ^
                                                                         ^             ^

> hmm.. I'm missing something here...

Yup.

> won't that simply escape double quotes and not affect spaces?

No.

:-)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list