Skip to content

Commit fef2e8e

Browse files
committed
Fix another infinite redirect bug
1 parent 9b72be0 commit fef2e8e

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

app.pl

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,12 @@
44

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

7-
get '*dir/:file' => sub {
8-
my $self = shift;
9-
my $dir = $self->param('dir');
10-
my $file = $self->param('file');
11-
return $self->redirect_to("/$dir/$file.html");
12-
};
7+
get '/' => sub { shift->reply->static('/index.html') };
138

14-
get '*dir' => [ dir => qr{.+/} ] => sub {
9+
get '*dir' => sub {
1510
my $self = shift;
1611
( my $dir = $self->param('dir') ) =~ s{/$}{};
17-
return $self->redirect_to("/$dir.html");
18-
};
19-
20-
get '/' => sub {
21-
my $self = shift;
22-
return $self->redirect_to('/index.html');
12+
$self->reply->static("/$dir.html");
2313
};
2414

2515
app->start;

0 commit comments

Comments
 (0)