fix [ 1328763 ] 6.7.3 FileAsset file size has incorrect value when displayed

This commit is contained in:
JT Smith 2005-10-17 18:19:20 +00:00
parent 7f1608a444
commit fb5555e17c
2 changed files with 14 additions and 3 deletions

View file

@ -45,6 +45,9 @@
- fix [ 1328105 ] Pages should contain "no-cache" tags
- fix [ 1216810 ] anonymous registration errors persist
- fix [ 1323272 ] Site modifications using GET in stead of POST
- fix [ 1328763 ] 6.7.3 FileAsset file size has incorrect value when
displayed
6.7.6

View file

@ -196,6 +196,7 @@ sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
my $storage = $self->getStorageLocation;
delete $self->{_storageLocation};
my $filename = $storage->addFileFromFormPost("file");
if (defined $filename) {
my %data;
@ -205,10 +206,7 @@ sub processPropertiesFromFormPost {
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
$self->update(\%data);
$self->setSize($storage->getFileSize($filename));
$self->{_storageLocation} = $storage;
}
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
}
@ -232,6 +230,16 @@ sub purgeRevision {
return $self->SUPER::purgeRevision;
}
#-------------------------------------------------------------------
sub setSize {
my $self = shift;
my $fileSize = shift || 0;
my $storage = $self->getStorageLocation;
foreach my $file (@{$storage->getFiles}) {
$fileSize += $storage->getFileSize($file);
}
$self->SUPER::setSize($fileSize);
}
#-------------------------------------------------------------------