about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-09 10:53:10 +0000
committerEric Wong <e@80x24.org>2016-01-09 10:53:14 +0000
commite70b30144eb62aba848437026bf4e3d5d5ed60c8 (patch)
tree5cfa27dd795111cf0b24defa3d3841a3ac60fa37 /lib
parent5b77f52067420fee90b0e73485639c51154a8b86 (diff)
downloadpublic-inbox-e70b30144eb62aba848437026bf4e3d5d5ed60c8.tar.gz
Sometimes users forget trailing slashes; but we should not punish
them with infinite loops.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/WWW.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 411db16f..d5635d84 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -47,7 +47,9 @@ sub run {
 
         # 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) {