Fix a bug where storage objects allow deleting of files in other storage objects.

This commit is contained in:
Colin Kuskie 2007-07-23 16:24:37 +00:00
parent 9fe8fc782e
commit 99d7037532
2 changed files with 33 additions and 1 deletions

View file

@ -465,6 +465,7 @@ it doesn't.
sub deleteFile {
my $self = shift;
my $filename = shift;
return undef if $filename =~ m{\.\./}; ##prevent deleting files outside of this object
unlink($self->getPath($filename));
}
@ -774,6 +775,20 @@ sub getPath {
}
#-------------------------------------------------------------------
=head2 getPathFrag ( )
Returns the internal, upload dir specific part of the path.
=cut
sub getPathFrag {
my $self = shift;
return join '/', $self->{_part1}, $self->{_part2}, $self->getFileId;
}
#-------------------------------------------------------------------
=head2 getUrl ( [ file ] )