From d6b61f492599c2b23d6572986d9d501c285c41b9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 23 Aug 2014 16:39:16 +0200 Subject: [PATCH] More charset hackery --- src/lib/Hydra/Controller/Root.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 5cbe60ea..02918fc0 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -22,6 +22,7 @@ sub noLoginNeeded { $c->request->path =~ /^static\//; } + sub begin :Private { my ($self, $c, @args) = @_; @@ -196,11 +197,10 @@ sub default :Path { sub end : ActionClass('RenderView') { my ($self, $c) = @_; - my @errors = map { encode_utf8($_); } @{$c->error}; - if (defined $c->stash->{json}) { - if (scalar @errors) { - $c->stash->{json}->{error} = join "\n", @errors; + if (scalar @{$c->error}) { + # FIXME: dunno why we need to do decode_utf8 here. + $c->stash->{json}->{error} = join "\n", map { decode_utf8($_); } @{$c->error}; $c->clear_errors; } $c->forward('View::JSON'); @@ -209,7 +209,7 @@ sub end : ActionClass('RenderView') { elsif (scalar @{$c->error}) { $c->stash->{resource} = { error => join "\n", @{$c->error} }; $c->stash->{template} = 'error.tt'; - $c->stash->{errors} = [@errors]; + $c->stash->{errors} = $c->error; $c->response->status(500) if $c->response->status == 200; if ($c->response->status >= 300) { $c->stash->{httpStatus} =