From: Mark Wooding Date: Sun, 11 Jun 2023 16:51:46 +0000 (+0100) Subject: mason/.perl-lib/TrivGal.pm: Append `/' to folder names. X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/commitdiff_plain/24f4eac3128ad2053a503924519076a2cd342e95 mason/.perl-lib/TrivGal.pm: Append `/' to folder names. Probably pedantically technical. I was considering doing this anyway, and then noticed that folders listed in an index file (a) must have a trailing `/' to be recognized as a folder, and (b) this doesn't get removed in the generated contact page. --- diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index 9b05723..600e9f5 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -285,6 +285,7 @@ sub listdir ($) { my (@d, @f); my $ix = undef; + $path =~ s#/$##; if (-f "$path/.tgal.index") { open my $f, "<", "$path/.tgal.index"; my $item = undef; @@ -338,7 +339,7 @@ sub listdir ($) { my $st = stat "$path/$e"; my $list = undef; if ($dotp) { } - elsif (-d $st) { $list = \@d; } + elsif (-d $st) { $list = \@d; $e .= "/"; } elsif ($TYPE{lc $ext} && -f $st) { $list = \@f; } $list and push @$list, TrivGal::Item->new($e); } diff --git a/mason/dhandler b/mason/dhandler index ef7044c..014f5da 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -110,7 +110,7 @@ Failed to find ‘<% $path |h %>’. % for my $size (qw{medthumb}) {