You are here: Foswiki>Tasks Web>Item11586 (11 Apr 2012, GeorgeClark)Edit Attach

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

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component:
Branches: Release01x01 trunk
Reported By: SvenDowideit
Waiting For:
Last Change By: GeorgeClark
# 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, sad smile

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

-- SvenDowideit - 29 Feb 2012
 

%META:TOPICINFO{author="BaseUserMapping_123" comment="save topic" date=".*?" format="1.1" reprev="1" version="1"}%
I Attachment Action Size Date Who Comment
IMG_0608.JPGJPG IMG_0608.JPG manage 744 K 30 Oct 2006 - 18:32 UnknownUser A Comment
Item11586.patchpatch Item11586.patch manage 2 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 Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy