X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstemmaweb%2FView%2FSVG.pm;h=13419e39062c51e33eb43ccb2450e85685fe4142;hb=6cf17f047a7cc39d7f0c691bad4df9839cae573c;hp=b8e4673e52bc811a4c28ae383b126c8586b77893;hpb=5800cf9ea8c4513f385b9823f4778bce34caf8fd;p=scpubgit%2Fstemmaweb.git diff --git a/lib/stemmaweb/View/SVG.pm b/lib/stemmaweb/View/SVG.pm index b8e4673..13419e3 100644 --- a/lib/stemmaweb/View/SVG.pm +++ b/lib/stemmaweb/View/SVG.pm @@ -2,13 +2,16 @@ package stemmaweb::View::SVG; use strict; use base 'Catalyst::View'; -use Encode qw( decode_utf8 ); sub process { - my( $self, $c ) = @_; - $c->res->content_type( 'image/svg+xml' ); - $c->res->content_encoding( 'UTF-8' ); - $c->res->output( decode_utf8( $c->stash->{result} ) ); + my( $self, $c ) = @_; + $c->res->content_type( 'image/svg+xml' ); + $c->res->content_encoding( 'UTF-8' ); + if( $c->stash->{download} ) { + $c->res->header( 'Content-Disposition', + sprintf( "attachment; filename=\"%s.svg\"", $c->stash->{name} ) ); + } + $c->res->output( $c->stash->{result} ); } 1;