Skip to content

Commit

Permalink
fixed path generation bug in Mojolicious::Routes::Match
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 17, 2014
1 parent 2f52d22 commit 1c86c3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,5 @@

5.0 2014-05-16
5.0 2014-05-17
- Code name "Tiger Face", this is a major release.
- Changed heuristics for number detection in Mojo::JSON to better line up
with user expectations.
Expand All @@ -17,6 +17,7 @@
- Improved Mojo::Parameters to consistently accept arrays.
- Fixed Mojo::IOLoop::Server to work correctly with newer versions of
IO::Socket::SSL. (noxxi)
- Fixed path generation bug in Mojolicious::Routes::Match.
- Fixed warnings in Mojo::IOLoop::Delay.

4.99 2014-05-12
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Routes/Match.pm
Expand Up @@ -24,7 +24,7 @@ sub path_for {
%values = (%$captures, format => undef, %values);
my $pattern = $endpoint->pattern;
$values{format}
= defined $captures->{format}
//= defined $captures->{format}
? $captures->{format}
: $pattern->defaults->{format}
if $pattern->constraints->{format};
Expand Down
1 change: 1 addition & 0 deletions t/mojolicious/routes.t
Expand Up @@ -538,6 +538,7 @@ is_deeply $m->stack, [], 'empty stack';
$m = Mojolicious::Routes::Match->new(root => $r);
$m->match($c => {method => 'GET', path => '/format2.txt.txt'});
is_deeply $m->stack, [], 'empty stack';
is $m->path_for('format2', format => 'txt'), '/format2.txt', 'right path';

# Format with constraint alternatives
$m = Mojolicious::Routes::Match->new(root => $r);
Expand Down

0 comments on commit 1c86c3e

Please sign in to comment.