cleaning up jukka's mess

This commit is contained in:
JT Smith 2006-04-30 16:30:48 +00:00
parent b33bc102df
commit 0733c3a5a5
2 changed files with 7 additions and 12 deletions

View file

@ -29,7 +29,7 @@ use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK DECLINED NOT_FOUND DIR_MAGIC_TYPE);
use Apache2::ServerUtil ();
use File::MMagic;
use LWP::MediaTypes qw(guess_media_type);
#-------------------------------------------------------------------
@ -106,20 +106,15 @@ sub contentHandler {
}
$session->http->setCookie("wgSession",$session->var->{_var}{sessionId}) unless $session->var->{_var}{sessionId} eq $session->http->getCookies->{"wgSession"};
my $filename = $session->http->getStreamedFile();
# print STDERR "file $filename and setting ".$session->config->get("enableStreamingUploads")."!\n";
if ((defined $filename) && ($session->config->get("enableStreamingUploads") eq "1")) {
#my $subr = $r->lookup_file($filename,$r->output_filters);
my $mm = new File::MMagic;
my $ct = $mm->checktype_filename($filename);
my $oldContentType = $r->content_type($ct);
# print STDERR "contenttype ".$r->content_type()."!\n";
if ($r->sendfile($filename) ) {
return Apache2::Const::OK();
my $ct = guess_media_type($filename);
my $oldContentType = $r->content_type($ct);
if ($r->sendfile($filename) ) {
return Apache2::Const::OK();
} else {
$r->content_type($oldContentType);
$r->content_type($oldContentType);
}
}
$session->http->sendHeader();
unless ($session->http->isRedirect()) {
$session->output->print($output);

View file

@ -374,7 +374,7 @@ sub www_view {
return $self->getContainer->www_view;
}
$self->session->http->setRedirect($self->getFileUrl);
$self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
$self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
return '1';
}