--- okuchuu/piclist.ja.cgi 2005/02/26 04:15:33 1.5
+++ okuchuu/piclist.ja.cgi 2005/03/11 11:51:48 1.6
@@ -8,14 +8,12 @@
=cut
-unless ($main::ENV{PATH_TRANSLATED}) {
- die "BAD PATH_TRANSLATED";
-}
+my $dir = $main::ENV{PATH_TRANSLATED}
+ or die "BAD PATH_TRANSLATED: $ENV{PATH_TRANSLATED}";
my %Opt;
-my $dir = $main::ENV{PATH_TRANSLATED};
-if ($dir =~ s#/LIST$##) {
+if ($dir =~ s#/[^/]+$##) {
for (split /[&;]/, $ENV{QUERY_STRING}) {
my ($name, $val) = split /=/, $_, 2;
$Opt{$name} = defined $val ? $val : 1;
@@ -56,6 +54,10 @@
}
}
+unless (-d $dir) {
+# $dir =~ s#/+[^/]+$##;
+}
+
opendir DIR, $dir or die "$dir: $!";
my @all_files = sort grep {not /^\./ and /^[A-Za-z0-9._-]+$/}
(readdir DIR)[0..1000];
@@ -77,7 +79,7 @@
my $title = '画像一覧';
my $dirpath = escape $ENV{REQUEST_URI};
$dirpath =~ s/\?.*$//;
-$dirpath =~ s#/LIST$##;
+$dirpath =~ s#/[^/]+$##;
$dirpath ||= '/';
print STDOUT "Content-Type: text/html; charset=euc-jp\n\n";
@@ -102,8 +104,8 @@
if ($Opt{cframe}) {
my $LISTqt = ($LISTq eq 'LIST' ? $LISTq . '?' : $LISTq . ';') . 'target=view';
print qq{