In prepare_action(), the $dir variable should have its metacharacters
quoted before being turned into a regexp. Not doing so can cause
problems, in particular with backslashes in directory names on Windows.
Patch attached,
Vlad Dan Dascalescu
Subject: | Static-Simple_quotemeta_patch.diff |
--- Simple.pm Wed Jul 05 09:34:47 2006
+++ Simple.vlad Thu Dec 07 23:12:52 2006
@@ -23,9 +23,10 @@
# is the URI in a static-defined path?
foreach my $dir ( @{ $c->config->{static}->{dirs} } ) {
- my $re = ( $dir =~ /^qr\//xms ) ? eval $dir : qr/^${dir}/;
+ my $dir_re = quotemeta $dir;
+ my $re = ( $dir =~ /^qr\//xms ) ? eval $dir : qr/^${dir_re}/;
if ($@) {
- $c->error( "Error compiling static dir regex '$dir': $@" );
+ $c->error( "Error compiling static dir regex '$dir_re': $@" );
}
if ( $path =~ $re ) {
if ( $c->_locate_static_file( $path ) ) {