Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/pause_2017/PAUSE/Web/Plugin/RenderYAML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ sub register {
local $YAML::Syck::ImplicitUnicode = 1;
my $dump = YAML::Syck::Dump($data);
my $edump = Encode::encode_utf8($dump);
my $action = $c->req->param('ACTION') || 'pause';
$action =~ tr/a-z0-9_//cd;
$c->res->headers->content_disposition("attachment; filename=$action.yaml");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mojo won't allow to set newlines in the header value, but I'd still be careful about directly injecting a request parameter into a response header.

$c->res->headers->content_type('application/yaml');
$c->stash(format => "text");
$c->render(text => $edump);
return;
Expand Down