Fix the MIME type bug that I introduced when making File assets work with

the exporter properly.
This commit is contained in:
Drake 2006-11-11 00:25:57 +00:00
parent e982302c2a
commit c14b75f606
4 changed files with 29 additions and 6 deletions

View file

@ -5,6 +5,7 @@
ldapAlias config setting and it crash (Martin Kamerbeek / Procolix)
- fix: entry in error log of WebGUI
- Fixed part of RSSCapable addition upgrade script in 7.2.0.
- fix: MIME types broken from change to the way File assets were streamed
7.2.0
- Added server side spellchecker (Martin Kamerbeek / Procolix)

View file

@ -2133,5 +2133,20 @@ true.
sub isValidRssItem { 1 }
#-------------------------------------------------------------------
=head2 exportHtml_view ( )
View method for static export. This is like www_view, and defaults to
just calling www_view, but this needs to be overridden if www_view
depends on there being an actual HTTP response on the other end.
=cut
sub exportHtml_view {
my $self = shift;
$self->www_view(@_);
}
1;

View file

@ -369,14 +369,16 @@ sub www_edit {
}
#-------------------------------------------------------------------
sub www_view {
# setStreamedFile and setRedirect do not interact well with the
# exporter. We have a separate method for this now.
sub exportHtml_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
# if ($self->session->var->get("adminOn")) {
# return $self->session->asset($self->getContainer)->www_view;
# }
# Kludge for now to make this work with the exporter.
my $path = $self->getStorageLocation->getPath($self->get('filename'));
my $fh = eval { FileHandle->new($path) };
defined($fh) or return "";
@ -387,10 +389,15 @@ sub www_view {
}
$fh->close;
return 'chunked';
}
# $self->session->http->setRedirect($self->getFileUrl);
# $self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
# return '1';
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
$self->session->http->setRedirect($self->getFileUrl);
$self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
return 'chunked';
}

View file

@ -156,7 +156,7 @@ sub _exportAsHtml {
} else {
$assetSession->output->setHandle($file);
$assetSession->asset($asset);
my $content = $asset->www_view;
my $content = $asset->exportHtml_view;
unless ($content eq "chunked") {
$assetSession->output->print($content);
}