Subject: | Content-type unset |
Catalyst::View::GraphViz sets the content type if it is not already set.
However, Catalyst::Action::RenderView also sets it if it is not already
set, and it does this before the view is called. This causes the graph
to be served with the wrong type.
The patch below works around this.
--- GraphViz.pm~ 2009-11-25 11:05:14.000000000 +0000
+++ GraphViz.pm 2009-11-30 15:46:07.916528273 +0000
@@ -296,7 +296,7 @@
gd2 => $plain,
gif => 'image/gif',
jpeg => 'image/jpeg',
- png => 'image/x-png',
+ png => 'image/png',
wbmp => 'image/x-ms-bmp',
cmap => $plain,
cmapx => $plain,
@@ -337,8 +337,12 @@
$c->error($error);
return 0;
}
-
- $c->response->content_type or $c->response->content_type($contentType);
+
+ # Override the default content type set by
Catalyst::Action::RenderView:
+ if ( join('; ', $c->response->content_type) eq 'text/html;
charset=utf-8'
+ or not $c->response->content_type ) {
+ $c->response->content_type($contentType)
+ }
$c->response->body($output);