Skip to content

Commit

Permalink
more defensive regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 29, 2014
1 parent db0d146 commit b4e2362
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Controller.pm
Expand Up @@ -388,7 +388,7 @@ sub url_for {
if ($target =~ m!^/!) {
if (my $prefix = $self->stash->{path}) {
my $real = $req->url->path->to_route;
$real =~ s!/?$prefix$!$target!;
$real =~ s!/?\Q$prefix\E$!$target!;
$target = $real;
}
$url->parse($target);
Expand Down
5 changes: 2 additions & 3 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -99,9 +99,8 @@ sub render {
my $content = $stash->{'mojo.content'} ||= {};
local $content->{content} = $output if $stash->{extends} || $stash->{layout};
while ((my $extends = $self->_extends($stash)) && !defined $inline) {
$options->{handler} = $stash->{handler};
$options->{format} = $stash->{format} || $self->default_format;
$options->{template} = $extends;
@$options{qw(handler template)} = ($stash->{handler}, $extends);
$options->{format} = $stash->{format} || $self->default_format;
$self->_render_template($c, \$output, $options);
$content->{content} = $output
if $content->{content} !~ /\S/ && $output =~ /\S/;
Expand Down

0 comments on commit b4e2362

Please sign in to comment.