Tags:
create new tag
, view all tags

Bug: Part of meta data is appearing in the topic

Just started on TWiki.org (31 Dec 2002), the following is appearing by itself in the topic after an edit:


Seems to be separated from rest of meta data by a new line.

Doesn't happen for all topics.

-- JohnTalintyre - 31 Dec 2002

Test case

Environment

TWiki version:  
TWiki plugins:  
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  

Follow up

The bug happens when there is no new line at the end of the topic when you hit preview.

Fix record

This was an side effect of the beforeSaveHandler() Plugin callback in TWiki::Store::saveTopic. The text supplied to the callback does now include the serialized meta data. Part of saveTopic:

    $text = $meta->write( $text );  # add meta data for Plugin callback
    TWiki::Plugins::beforeSaveHandler( $text, $topic, $web );
    $meta = TWiki::Meta->remove();  # remove all meta data
    $text = $meta->read( $text );   # restore meta data

This is the patch that solves the problem:

*** ../../TWiki/Meta.pm Mon Dec 30 09:47:04 2002
--- TWiki/Meta.pm       Tue Dec 31 10:39:00 2002
***************
*** 336,342 ****

      my $start = $self->writeStart();
      my $end = $self->writeEnd();
!     $text = $start . "$text" . $end;

      return $text;
  }
--- 336,344 ----

      my $start = $self->writeStart();
      my $end = $self->writeEnd();
!     $text = $start . "$text";
!     $text =~ s/([^\n\r])$/$1\n/;     # new line is required at end
!     $text .= $end;

      return $text;
  }

Fix is in TWikiAlphaRelease and TWiki.org.

-- PeterThoeny - 31 Dec 2002

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2002-12-31 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.