diff --git a/core/lib/Foswiki/Sandbox.pm b/core/lib/Foswiki/Sandbox.pm index 4e98c5513..f07eb2446 100644 --- a/core/lib/Foswiki/Sandbox.pm +++ b/core/lib/Foswiki/Sandbox.pm @@ -238,16 +238,16 @@ sub _cleanUpFilePath { next unless ( defined($component) && $component ne '' || $first ); $first = 0; $component = '' unless defined $component; - next if $component eq '.'; - if ( $component eq '..' ) { - throw Error::Simple( 'relative path in filename ' . $string ); - } - elsif ( $component =~ m/$Foswiki::cfg{AttachmentNameFilter}/ ) { + if ( $component =~ m/$Foswiki::cfg{AttachmentNameFilter}/ ) { throw Error::Simple( 'illegal characters in file name component "' . $component . '" of filename ' . $string ); } + next if $component eq '.'; + if ( $component eq '..' ) { + throw Error::Simple( 'relative path in filename ' . $string ); + } push( @result, $component ); }