Foswiki on GitHub is open for business! Next release meeting: Monday September 29, 1300Z

Item11586: Foswiki::Func::saveTopicText() with embedded META:TOPICINFO duplicates the TOPICINFO.

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Urgent Closed Engine    
# Verify that saveTopicText uses embedded meta
sub test_saveTopicTextEmbeddedMeta {
    my $this     = shift;
    my $topic    = 'SaveTopicText2';
    my $origtext = <<'NONNY';
'Tis some text
and a trailing newline



NONNY
    Foswiki::Func::saveTopicText( $this->{test_web}, $topic, $origtext );
    my $text1 = Foswiki::Func::readTopicText( $this->{test_web}, $topic );
    
    #make sure that the save changed the topicinfo
    $this->assert_does_not_match( qr/$origtext/, $text1 );
    my ( $meta, $text ) = Foswiki::Func::readTopic( $this->{test_web}, $topic );
    #make sure that the save extracted the META:
    $this->assert_does_not_match( qr/%META/, $text );


    return;
}

  1. passes on foswiki 1.0.10 (and 1.0.0)
  2. fails on 1.1.0 because the author="BaseUserMapping_123" appears to be saved directly to the file - ie, innapropriately attributing the save to another user
  3. fails on 1.1.3 for the same reason as 1.1.0
  4. fails on 1.1.4 because it duplicates the TOPICINFO - saveTopicText is supposed to parse and use the embedded meta for legacy reasons
  5. fails on 1.1 branch (1.1.5 pre) because it duplicates the TOPICINFO - saveTopicText is supposed to parse and use the embedded meta for legacy reasons
  6. fails on trunk because it duplicates the TOPICINFO - saveTopicText is supposed to parse and use the embedded meta for legacy reasons

it seems that the duplicate TOPICINFO error was introduced by http://trac.foswiki.org/changeset/11893 and http://trac.foswiki.org/changeset/11894 - in which i did a quick change without adding a failing unit test in Tasks.Item10789

-- SvenDowideit - 29 Feb 2012

actually, this needs further investigation, as I'm trusting what readTopicText tells me - I need to add another assertion that readTopicText is what is on disk..

-- SvenDowideit - 29 Feb 2012

and now i'm running the test again, and getting totally different (worse) results. so clearly today isn't working out for me.

-- SvenDowideit - 29 Feb 2012

er, the META:TOPICINFO line below here was the first line of the unit test. talk about a nafup.

the tests i'm runing atm suggest that the duplication is older

-- SvenDowideit - 29 Feb 2012

god this stuff is a legacy mess frown

in the end, I think I'm fixing it by adding a hacky regex to Func::saveTopicText frown

-- SvenDowideit - 29 Feb 2012
 

%META:TOPICINFO{author="BaseUserMapping_123" comment="save topic" date=".*?" format="1.1" reprev="1" version="1"}%

ItemTemplate edit

Summary Foswiki::Func::saveTopicText() with embedded META:TOPICINFO duplicates the TOPICINFO.
ReportedBy SvenDowideit
Codebase 1.1.4, trunk
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins Foswikirev:14159 Foswikirev:14160 Foswikirev:14161 Foswikirev:14162 Foswikirev:14163 Foswikirev:14164
TargetRelease patch
ReleasedIn 1.1.5
CheckinsOnBranches Release01x01 trunk
trunkCheckins Foswikirev:14162 Foswikirev:14163 Foswikirev:14164
Release01x01Checkins Foswikirev:14159 Foswikirev:14160 Foswikirev:14161
Topic attachments
I Attachment Action Size Date Who Comment
IMG_0608.JPGJPG IMG_0608.JPG manage 744.1 K 30 Oct 2006 - 18:32 UnknownUser A Comment
Item11586.patchpatch Item11586.patch manage 2.8 K 29 Feb 2012 - 08:33 SvenDowideit this unit test passes on foswiki 1.0.10
Topic revision: r12 - 11 Apr 2012, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License