Fix serving plain text files

This commit is contained in:
Eelco Dolstra 2017-11-21 17:55:52 +01:00
parent 5986aae704
commit b7bc4384b7
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -7,7 +7,9 @@ use base 'Catalyst::View::Download::Plain';
sub process {
my ($self, $c) = @_;
$c->clear_encoding;
$c->response->content_type('text/plain; charset=utf-8') if $c->response->content_type() eq "text/plain";
my $type = $c->response->content_type();
$c->response->content_type('text/plain; charset=utf-8')
if !$type || $c->response->content_type() eq "text/plain";
$c->response->body($c->stash->{plain}->{data});
}