X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCommon.pm;h=c67c58c003f8fc9f61b623c412b6ce5e9364e022;hb=e436a6b05600897aed8c5420d44bf4e1b39cb74f;hp=9c83c7d174de0b2cce7dbd5bf733f03da22f8b87;hpb=8626a95d5b7c1a13b53ac8d3d486bf62be149885;p=kivitendo-erp.git diff --git a/SL/Common.pm b/SL/Common.pm index 9c83c7d17..c67c58c00 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -290,13 +290,24 @@ sub webdav_folder { } else { my $base_path = substr($ENV{'SCRIPT_NAME'}, 1); $base_path =~ s|[^/]+$||; + $base_path =~ s|/$||; - foreach my $file (<$path/*>) { - my $fname = $file; - $fname =~ s|.*/||; - $form->{WEBDAV}{$fname} = - ($ENV{"HTTPS"} ? "https://" : "http://") . - $ENV{'SERVER_NAME'} . "/" . $base_path . $file; + if (opendir $dir, $path) { + foreach my $file (readdir $dir) { + next if (($file eq '.') || ($file eq '..')); + + my $fname = $file; + $fname =~ s|.*/||; + + my $physical_file = "$path/$file"; + + $file = join('/', map { $form->escape($_) } grep { $_ } split m|/+|, "$path/$file"); + $file .= '/' if (-d $physical_file); + + $form->{WEBDAV}->{$fname} = ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file"; + } + + closedir $dir; } }