Skip to content

Commit

Permalink
Item13883: improve filename validation (Item15163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Aug 5, 2022
1 parent a7741b2 commit 34663ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/lib/Foswiki/Sandbox.pm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ sub validateAttachmentName {
my @result;
foreach my $component (@dirs) {
return unless defined($component) && $component ne '';

# Filter nasty characters
$component =~ s/$Foswiki::cfg{AttachmentNameFilter}//g;

next if $component eq '.';
if ( $component eq '..' ) {
if ( scalar(@result) ) {
Expand All @@ -215,8 +219,6 @@ sub validateAttachmentName {
}
else {

# Filter nasty characters
$component =~ s/$Foswiki::cfg{AttachmentNameFilter}//g;
push( @result, $component );
}
}
Expand Down

0 comments on commit 34663ca

Please sign in to comment.