Do not set a redirect when streaming downloads. fixes file #11029

This commit is contained in:
Colin Kuskie 2009-09-23 21:27:43 -07:00
parent 564378bba8
commit 77fc01af38
3 changed files with 26 additions and 17 deletions

View file

@ -656,19 +656,20 @@ When viewed directly, stream the stored file to the user.
=cut
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
my $self = shift;
my $session = $self->session;
return $session->privilege->noAccess() unless $self->canView;
# Check to make sure it's not in the trash or some other weird place
if ($self->get("state") ne "published") {
my $i18n = WebGUI::International->new($self->session,'Asset_File');
$self->session->http->setStatus("404");
my $i18n = WebGUI::International->new($session,'Asset_File');
$session->http->setStatus("404");
return sprintf($i18n->get("file not found"), $self->getUrl());
}
$self->session->http->setRedirect($self->getFileUrl);
$self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
$self->session->http->sendHeader;
$session->http->setRedirect($self->getFileUrl) unless $session->config->get('enableStreamingUploads');
$session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
$session->http->sendHeader;
return 'chunked';
}