Item11586: Foswiki::Func::saveTopicText() with embedded META:TOPICINFO duplicates the TOPICINFO.
Priority: Urgent
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component:
Branches: Release01x01 trunk
# 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;
}
- passes on foswiki 1.0.10 (and 1.0.0)
- 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
- fails on 1.1.3 for the same reason as 1.1.0
- fails on 1.1.4 because it duplicates the TOPICINFO -
saveTopicText
is supposed to parse and use the embedded meta for legacy reasons
- 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
- 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
in the end, I think I'm fixing it by adding a hacky regex to Func::saveTopicText
--
SvenDowideit - 29 Feb 2012
%META:TOPICINFO{author="BaseUserMapping_123" comment="save topic" date=".*?" format="1.1" reprev="1" version="1"}%