From b7bc4384b7b471d1ddf892cb03f16189a66d5a0d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 21 Nov 2017 17:55:52 +0100 Subject: [PATCH] Fix serving plain text files --- src/lib/Hydra/View/Plain.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/View/Plain.pm b/src/lib/Hydra/View/Plain.pm index 868c74f8..452a3d46 100644 --- a/src/lib/Hydra/View/Plain.pm +++ b/src/lib/Hydra/View/Plain.pm @@ -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}); }