Item8437: Renaming an attachment does not remove old meta data

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: KennethLavrsen
Try moving an attachment on the same topic by renaming it. Then check the raw topic data. The old META:FILEATTACHMENT is still there in addition to the new one.

Here's a quick fix. Please have a look.
--- lib/Foswiki/Meta.pm (revision 6143)
+++ lib/Foswiki/Meta.pm (working copy)
@@ -2369,6 +2373,10 @@
         $fileAttachment->{movedwhen} = time();
         $to->putKeyed( 'FILEATTACHMENT', $fileAttachment );

+        if ($this->getPath() eq $to->getPath()) {
+          $to->remove( 'FILEATTACHMENT', $name );
+        }
+
         $to->saveAs(
             undef, undef,

-- MichaelDaum - 28 Jan 2010

That should work. Have you run the unit tests?

-- CrawfordCurrie - 31 Jan 2010

Sorry no.

Most of the unit test fail for me currently for non-related issues as I tend to have trunk running with a christmas tree of other stuff enabled.

-- MichaelDaum - 31 Jan 2010
 

ItemTemplate edit

Summary Renaming an attachment does not remove old meta data
ReportedBy MichaelDaum
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:789c851ea2f3
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r6 - 22 Mar 2010, KennethLavrsen
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