mason/.perl-lib/TrivGal.pm (listdir): Anchor regex to line start.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 11 Jun 2023 15:29:37 +0000 (16:29 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 11 Jun 2023 15:29:37 +0000 (16:29 +0100)
I don't think this is actually a problem, because the pattern
irrefutably matches at the start of the line anyway.  But for form's
sake, it should be properly anchored.

mason/.perl-lib/TrivGal.pm

index bbef2ed..85bf0cc 100644 (file)
@@ -294,7 +294,7 @@ sub listdir ($) {
        $comment = defined $comment ? $comment . "\n" . $_ : $_;
       } else {
        if ($item && $comment) { $item->comment($comment); }
-       my ($indexp, $name, $c) = /(!\s+)?(\S+)\s*(\S|\S.*\S)?\s*$/;
+       my ($indexp, $name, $c) = /^(!\s+)?(\S+)\s*(\S|\S.*\S)?\s*$/;
        $name = urldecode $name;
        my $list;
        if ($name =~ m#/$#) {