Files attached to twiki are coming back corrupted, with an extra newline character added to the end. Many programs are tolerant of this extra byte, but some (like Java) are not.
When we attach ZIP files to a wiki page, an extra byte is appended to the file at the end: 0x0A
--
TWiki:Main/SethPackham
- 22 Jan 2010
Originally reported at
TWiki:Support/SID-00726
--
TWiki:Main.PeterThoeny
- 23 Jan 2010
This issue seems to be fixed in recent versions of the TWiki - kindly request you to try latest version of TWiki.
Please let me know if you want to stick to the old version - i can provide the patch here
Cheers
--
TWiki:Main.SopanShewale
- 05 Feb 2010
Could not recreate this - seems like its fixed - so changing the status.
--
TWiki:Main.SopanShewale
- 16 Feb 2010
we also have the same problem. can you please provide the patch so that we can overcome this issue at the earliest.
--
TWiki:Main.GauravMittal
- 09 Mar 2010
Peter, Can you please attach the Patch for this issue, so that i can install it as soon as possible. We are facing lot of issues because of this.
--
TWiki:Main.GauravMittal
- 10 Mar 2010
Hi - please check the following:
sopan@laptop:~/twikireleases/twiki432/lib/TWiki/UI$ diff -u View.pm ~sopan/twikireleases/twiki421/lib/TWiki/UI/View.pm --- View.pm 2009-09-02 18:59:23.000000000 +0530
+++ /home/sopan/twikireleases/twiki421/lib/TWiki/UI/View.pm 2008-08-04 03:43:32.000000000 +0530
@@ -430,35 +430,7 @@
if( defined( $query->param( 'filename' ))) {
$fileName = $query->param( 'filename' );
} else {
-
- # Ok file name is not comming from explicit query parameter
- # Let us cook from @path
-
- $fileName = pop( @path );
-
- #Let us redefine web/topic - fix of Item5967
-
- if( $fileName =~ /\.([^.]+)$/ ) { #file has extension
- my $suffix = $1;
- my $presuffix = $fileName;
- $presuffix =~ s/\.$suffix$//;
- $webName =~ s/$presuffix$//o; #let us drop filename part from webName
- $webName =~ s/\/$//o;
- if ($webName =~ /\/([^\/]+)$/) {$topic = $1;} #topic name defined here
- $webName =~ s/$topic$//o;
- $webName =~ s/\/$//o;
-
- } else { #file does not have extension
- $webName =~ s/$fileName$//o; #let us drop the filename from webName
- $webName =~ s/\/$//o;
- if ($webName =~ /\/([^\/]+)$/) {$topic = $1;} #topic name redefined here
- $webName =~ s/$topic$//o;
- $webName =~ s/\/$//o;
-
- }
-
-
-
+ $fileName = pop( @path );
}
if (!$fileName) {
throw TWiki::OopsException( 'attention',
@@ -485,10 +457,14 @@
my $type = _suffixToMimeType( $session, $fileName );
my $length = length( $fileContent );
my $dispo = 'inline;filename='.$fileName;
- print $query->header("-type"=>$type, "-Content-length"=>$length, "-Content-Disposition"=>$dispo,);
- print $fileContent;
+ print <<HERE;
+Content-type: $type
+Content-length: $length
+Content-Disposition: $dispo
+$fileContent
+HERE
}
sub _suffixToMimeType {
sopan@laptop:~/twikireleases/twiki432/lib/TWiki/UI$
--
TWiki:Main.SopanShewale
- 07 Apr 2010
Sopan, I'd be careful about removing the code if file name is part of extended view path. This is likely to break URLs like
http://example.com/pub/Baseweb/Subweb/SomePage/somefile.doc
This bug shows up only on two installs. I suspect a bug in CGI Perl module.
Gaurav and Seth: What is the version of CGI do you have installed? Test on command line:
perl -e 'use CGI; print "$CGI::VERSION\n"'
Try upgrading your CGI module.
--
TWiki:Main.PeterThoeny
- 07 Apr 2010
Hi Gaurav and Seth,
Please let us know the exact process: how you are noticing extra byte? are you downloading files via "viewfile"? (i have noticed extra byte in old versions while downloading via "viewfile")
or Are you downloading files via
%PUBURL%/web/topic/attachment
way?
Do you also see the extra bye when you login to twiki server, view attachment by going to pub/web/topic directory?
Please give us some more information
Thank you,
--
TWiki:Main.SopanShewale
- 12 Apr 2010