You are here: Foswiki>Tasks Web>Item9083 (04 Nov 2010, GeorgeClark)Edit Attach

Item9083: Plugin such as ActionTrackerPlugin eats newlines causing the meta to be pulled into the topic

Priority: Urgent
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ActionTrackerPlugin
Reported By: CraigBowers
Waiting For:
Last Change By: GeorgeClark
Checked on several 1.09 instances:

FW 1.09, all installed plugins at latest revs though I'd also manually tweaked Action Tracker as per Tasks.Item1187 to solve the 3 day reversion on submit.

Now that the date issue is resolved it's starting to be used more. However today I find that editing an existing Action created with the CommentPlugin, when edited with the edit link, seems to delete a line or line break from the bottom of the topic (at least if there is a form attached).

One by one my forms began disappeared on each topic with an edited action.

Looking at the raw topic text showed that the


Was shifting up and being concatenated with the previous line .

Last line of text ---

Last line of text ---%META:FIELD{name="...


Doesn't seem to matter if the Action is actually edited, resaving clobbers the form consistently each time.

Appears Skin independent as well. Occurs in both Pattern, and NatSkin.

-- CraigBowers - 11 May 2010

Editing the action a second time before restoring the now mangled form, further clobbers the form. All formfields are lost except the one previous concatenated to the last line of the topic text.

-- CraigBowers - 12 May 2010

I see similar issue. Suddenly the META:REVCOMMENT or something shows up in the topic text. It's not hidden anymore and it looks like it is because newlines before are removed, as Craig says here.

-- LarsEik - 02 Jun 2010

I'm seeing this as well, using ActionTrackerPlugin version 6244 (2010-02-07) on FW 1.0.9. I haven't yet tried BigBaaadBob's date fix from Tasks.Item8499, but plan to.

-- AaronFuleki - 28 Jun 2010

Item9933 looks like a similar issue

-- AndrewJones - 02 Nov 2010

Item9933 is the same issue.

I've run various tests and can report that when I edit an action and say change the date and save, the %Meta statements at the end of the topic (as seen in viewing the file on the server) are moved up one line. This happens on every edit until the %Meta statement becomes appended to the normal topic text and is displayed as if topic text. This happens whether the %Comment{type="action"}% is placed at the end or middle of the topic text.

-- BobCorless - 03 Nov 2010

I can confirm the bug

And here are the observations.

To reproduce you need

A topic with an action defined in the format with ENDACTION

%ACTION{ closed="2004-12-02" closer="" created="2004-12-01" creator="Main.KennethLavrsen" due="2004-12-22" notify="" state="closed" uid="000022" who="Main.KennethLavrsen" }% xmas evening celebration    <br />- Created by Main.KennethLavrsen, 03 Dec 2004 22:59:00 %ENDACTION%%ACTION{ closed="2009-01-29" closer="" created="2004-12-04" creator="Main.KennethLavrsen" due="2004-12-13" notify="" state="closed" uid="000026" who="Main.KennethLavrsen" }% hey   <br />- Created by Main.KennethLavrsen, 03 Dec 2004 23:41:31 %ENDACTION%

And some meta data in the topic. It can be an attachment.

And then each time you edit and save using the action tracker feature a newline is eaten after the last action. Everytime.

And you do not need any COMMENT tag on the page to see it.

But I cannot reproduce this on 1.0.10 as the original reporters have seen.

So is this a core bug or a ActionTrackerPlugin bug?

-- KennethLavrsen - 03 Nov 2010

Index: lib/Foswiki/Plugins/
--- lib/Foswiki/Plugins/   (revision 9728)
+++ lib/Foswiki/Plugins/   (working copy)
@@ -377,6 +377,7 @@
         afterEditHandler( $text, $topic, $web );
         # reattach the metadata
+   $text .= "\n" unless $text =~ /\n$/s;
         $_[0] = $premeta . $text . $postmeta;
     else {

To repair an existing topic that has been damaged, edit the topic in the standard text editor (not WYSIWYG!) and add a newline before the %META:ATTACHMENT

-- CrawfordCurrie - 03 Nov 2010

I have been digging more into this.

This plugin has always missed an empty line between the topic text and the meta

In Foswiki 1.0 the core code was forgiving and added the missing empty line.

In Foswiki 1.1 the line is not added and therefore eaten.

It has probably been too unpredictable this way.

The fix Crawford did eats one new line per edit until there is only one left and it will not leave an empty line between topic content and meta

I fear this can create trouble.

I add a little to Crawfords fix and it now works both in 1.0 and 1.1 without eating newlines and without adding them

-- KennethLavrsen - 03 Nov 2010

Checking in a unit test to verify no newlines dropped with round-trip through Func. Unrelated to the actual problem, but was written to help debug.

-- GeorgeClark - 04 Nov 2010
Topic revision: r13 - 04 Nov 2010, 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