# in case people leave off the trailing slash:
} elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/(f|T|t)\z!o) {
- r301($ctx, $1, $2, $3 eq 't' ? 't/#u' : $3);
+ my ($listname, $mid, $suffix) = ($1, $2, $3);
+ $suffix .= $suffix =~ /\A[tT]\z/ ? '/#u' : '/';
+ r301($ctx, $listname, $mid, $suffix);
# convenience redirects order matters
} elsif ($path_info =~ m!$LISTNAME_RE/([^/]{2,})\z!o) {
is($to, $res->header('Location'), 'redirect location matches');
});
+ my $pfx = 'http://example.com/test';
+ foreach my $t (qw(t T)) {
+ test_psgi($app, sub {
+ my ($cb) = @_;
+ my $u = $pfx . "/blah%40example.com/$t";
+ my $res = $cb->(GET($u));
+ is(301, $res->code, "redirect for missing /");
+ my $location = $res->header('Location');
+ like($location, qr!/\Q$t\E/#u\z!,
+ 'redirected with missing /');
+ });
+ }
+ foreach my $t (qw(f)) {
+ test_psgi($app, sub {
+ my ($cb) = @_;
+ my $u = $pfx . "/blah%40example.com/$t";
+ my $res = $cb->(GET($u));
+ is(301, $res->code, "redirect for missing /");
+ my $location = $res->header('Location');
+ like($location, qr!/\Q$t\E/\z!,
+ 'redirected with missing /');
+ });
+ }
+
test_psgi($app, sub {
my ($cb) = @_;
my $atomurl = 'http://example.com/test/new.atom';
'index generated');
});
- my $pfx = 'http://example.com/test';
test_psgi($app, sub {
my ($cb) = @_;
my $res = $cb->(GET($pfx . '/atom.xml'));