497,528c497,498 < if( !defined( $query->param( 'co' ))) { < $session->{response}->header(-type => $type, qq(Content-Disposition="$dispo") ); < $session->{response}->body($fileContent); < < }else { < my $q = CGI->new; < my $pubDir = $TWiki::cfg{PubDir}; < my $ffileName = $pubDir."/".$webName."/".$topic."/".$fileName; < my $copCmd = "/usr/bin/co -q -p1.$rev $ffileName "; < #Define the temporary file for the check out. < my $tco = "/tmp/TempCheckoutFile"; < < open(WRITE,">$tco"); < my ($textS, $statusS) = $TWiki::sandbox->sysCommand($copCmd); < binmode WRITE; < print WRITE "$textS\n"; < close(WRITE); < #Print out the download headers and sizes < print $q->header(-type => 'application/x-download', < -attachment => $fileName, < 'Content-length' => -s "$tco", < ); < < open(my $DLFILE, '<', "$tco") or return(0); < binmode $DLFILE; < print while <$DLFILE>; < undef ($DLFILE); < unlink($tco); < return(1); < < } < --- > $session->{response}->header(-type => $type, qq(Content-Disposition="$dispo") ); > $session->{response}->body($fileContent);