Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent infinite redirect on 404 files
Related to #576
  • Loading branch information
zoffixznet committed Jun 10, 2016
1 parent 7f15517 commit 9b72be0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.pl
Expand Up @@ -4,16 +4,16 @@

app->static->paths(['html']);

get '(*dir)/:file' => sub {
get '*dir/:file' => sub {
my $self = shift;
my $dir = $self->param('dir');
my $file = $self->param('file');
return $self->redirect_to("/$dir/$file.html");
};

get '(*dir)/' => sub {
get '*dir' => [ dir => qr{.+/} ] => sub {
my $self = shift;
my $dir = $self->param('dir');
( my $dir = $self->param('dir') ) =~ s{/$}{};
return $self->redirect_to("/$dir.html");
};

Expand Down

0 comments on commit 9b72be0

Please sign in to comment.