[interchange] Fix parsing TemplateDir at startup with multiple dirs on one line (RT# 318)
Gert van der Spoel <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 29b7e509a3febc84d809f7b93772f1ceb17ab73a Author: Gert van der Spoel <[email protected]> Date: Sun Mar 27 14:16:36 2011 +0200 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. WHATSNEW-5.7 | 4 ++++ lib/Vend/Config.pm | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) --- diff --git a/WHATSNEW-5.7 b/WHATSNEW-5.7 index c6d6730..817811a 100644 --- a/WHATSNEW-5.7 +++ b/WHATSNEW-5.7 @@ -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. diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm index 4eac5f9..02e9c44 100644 --- a/lib/Vend/Config.pm +++ b/lib/Vend/Config.pm @@ -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; }