Permalink
Browse files

Fix parsing TemplateDir at startup with multiple dirs on one line (RT…

…# 318)

When TemplateDir was defined like:
TemplateDir /path/to/dir /path/to/dir2

this was not being parsed correctly. This has now been resolved.
Thanks to Mat Jones for the report.
  • Loading branch information...
1 parent c197a2c commit 29b7e509a3febc84d809f7b93772f1ceb17ab73a Gert van der Spoel committed Mar 27, 2011
Showing with 19 additions and 9 deletions.
  1. +4 −0 WHATSNEW-5.7
  2. +15 −9 lib/Vend/Config.pm
View
@@ -35,6 +35,10 @@ Core
* Fixed a bug in the [read-cookie] tag which in very specific rare
circumstances could return the wrong value for a cookie.
+* Fixed a bug in parsing of TemplateDir directive with multiple directories
+ on a single line (RT#318).
+ Thanks to Mat Jones for the report.
+
Tags
----
* Allow sorting of forum entries.
View
@@ -3926,17 +3926,23 @@ sub parse_dir_array {
my($var, $value) = @_;
return [] unless $value;
- unless (allowed_file($value)) {
- config_error('Path %s not allowed in %s directive',
- $value, $var);
- }
- $value = "$C->{VendRoot}/$value"
- unless file_name_is_absolute($value);
- $value =~ s./+$..;
-
$C->{$var} = [] unless $C->{$var};
my $c = $C->{$var} || [];
- push @$c, $value;
+
+ my @dirs = grep /\S/, Text::ParseWords::shellwords($value);
+
+ foreach my $dir (@dirs) {
+ my $val;
+ unless (allowed_file($dir)) {
+ config_error('Path %s not allowed in %s directive',
+ $dir, $var);
+ }
+ $val = "$C->{VendRoot}/$dir"
+ unless file_name_is_absolute($val);
+ $val =~ s./+$..;
+ push @$c, $val;
+ }
+
return $c;
}

0 comments on commit 29b7e50

Please sign in to comment.