• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

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 smile

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 smile Thanks!

-- SP

ItemTemplate
Summary Plugin API / Store.pm: beforeAttachmentSaveHandler broken
ReportedBy TWiki:Main.SteffenPoulsen
Codebase

SVN Range Wed, 12 Apr 2006 build 9798
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins 10172 9810 9813
TargetRelease patch
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2006-05-13 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback