Makes it impossible also to use beforeSaveHandler in the same plugin as $text is reset in beforeAttachmentSaveHandler.
Suggested fix:
Index: TWiki/Store.pm
===================================================================
--- TWiki/Store.pm (revision 9809)
+++ TWiki/Store.pm (working copy)
@@ -899,8 +899,9 @@
open( F, $tmpFile );
binmode( F );
# transfer 512KB blocks
- while( my $r = sysread( $opts->{stream}, $text, 0x80000 )) {
- syswrite( F, $text, $r );
+ my $transfer;
+ while( my $r = sysread( $opts->{stream}, $transfer, 0x80000 )) {
+ syswrite( F, $transfer, $r );
}
close( F );
$attrs->{file} = $tmpFile;
@@ -924,8 +925,9 @@
# very big data files. It really should use the stream.
open( F, $tmpFile );
binmode(F);
- while( read($opts->{stream}, $text, 1024 )) {
- print F $text;
+ my $transfer;
+ while( read($opts->{stream}, $transfer, 1024 )) {
+ print F $transfer;
}
close(F);
$attrs->{file} = $tmpFile;
--
SP
SVN 9810/TWiki4.
Something is rotten with the file/stream conversion still, content ends up with being only the name, not the original content. I'd appreciate it if a master into these stream conversions would take a look.
- but now at least $text survives
Btw this came from messing with RevCommentPlugin, for a plugin that uses both handlers this can be used for testing.
--
SP
I added a testcase, which isolated the problem, fixed it, and corrected the doc in Emptyplugin.
CC
My hero
Thanks!
--
SP