diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 70610a9ae..be5cbb18a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,7 @@ when loading edit screens. - Fixed a problem with the new autocommit code that caused reply posts not to work in the collaboration system. + - Storage deletes were throwing fatals when they should throw warnings. 7.3.0 diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index 4731eebb9..da16db32e 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -384,13 +384,16 @@ sub delete { rmtree($path) if ($path); foreach my $subDir ($self->{_part1}.'/'.$self->{_part2}, $self->{_part1}) { my $uDir = $self->session->config->get('uploadsPath') . '/' . $subDir; - opendir my $DH, $uDir or - $self->session->errorHandler->fatal("Unable to open $uDir for directory reading"); - my @dirs = grep { !/^\.+$/ } readdir($DH); - if (scalar @dirs == 0) { - rmtree($uDir); + opendir my $DH, $uDir; + if (defined $DH) { + my @dirs = grep { !/^\.+$/ } readdir($DH); + if (scalar @dirs == 0) { + rmtree($uDir); + } + close $DH; + } else { + $self->session->errorHandler->warn("Unable to open $uDir for directory reading"); } - close $DH; } } return;