my regex flaw exposes another?

David A. Sinck plug-discuss@lists.plug.phoenix.az.us
Wed, 6 Mar 2002 14:07:46 -0700


\_ SMTP quoth Mike on 3/6/2002 16:04 as having spake thusly:
\_
\_ I'm in the process of putting a little CGI script
\_ (on it's way David:-) and below is a little snippet
\_ of the code. I know I'm bad at regex, I was trying to exclude
\_ both the ".", "..", and a directory called "approved".
\_ 
\_ Clicking on the link for the ".." directory pops up
\_ a nice little window with my entire Perl script in plain text!
\_ 
\_ foreach $file (@userfiles) {
\_   next if ($file =~ /(^\.)(approved)/);

perhaps 
  next if ($file =~ /^(\.{1,2}|approved)$/);

\_   print "<a href=\"javascript:openWin('/moliaps/$user/$file')\;\">\n";
\_   print "<image alt=\"Thumbnail for $file\" src=\"/moliaps/$user/$file\" width=\"50\" height=\"65\"></a><br>\n", 
\_   textfield('notes'),br;
\_   }
\_ 
\_ Is there something else I need to begin paying attention to
\_ so that this will not accidently happen again?

As for getting the script back...that's right amusing and could
potentially be a couple of things playing together (javascript,
apache, browser) or not.

David