You are here: Foswiki>Tasks Web>Item10927 (17 Dec 2011, GeorgeClark)Edit Attach

Item10927: Loss of metadata when an admin user updates an attachment's properties

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: PaulHarvey
Waiting For:
Last Change By: GeorgeClark
We've got data loss on our wiki when an admin user tries to update properties of an attachment.
  • Create a topic, add a form. Populate the form if you want.
  • Add an attachment.
  • Now update the properties of that attachment (manage attachment screen)
  • Now you've just lost all your metadata (dataform meta, or otherwise).

Replacing Foswiki::Meta->new() with Foswiki::Func::readTopic() fixes the problem.

Need to review all usage of Foswiki::Meta->new().

-- PaulHarvey - 29 Jun 2011

Thanks to PaulAlexander for discovering this bug!

-- PaulHarvey - 29 Jun 2011

I was going to review a lot of other usage of Foswiki::Meta->new(), but now I'm not so sure. We can close this task, I think, but I just wanted Crawford & Sven to have a quick grep to see if they can spot any more obviously "wrong" usage of Foswiki::Meta->new().

-- PaulHarvey - 29 Jun 2011

It's really hard to tell, but after a run through I can't see anything screaming at me. But then, I missed the case you describe above, so a visual check is clearly not enough; only unit tests will reveal. Did you add one for this case?

-- CrawfordCurrie - 02 Jul 2011

I did, distro:209708c44827 - it adds an extra assert, to ensure pre-existing metadata is still present after the save operation, makes the existing tests fail if you revert distro:8a4e8f613cd9

-- PaulHarvey - 02 Jul 2011

Seems we're done here. Closing.

-- PaulHarvey - 12 Jul 2011

Re-opened: we set ReleasedIn 1.1.4 but no checkins have occurred on Release01x01 branch

-- PaulHarvey - 02 Oct 2011

Changing to waiting for release. I mis-typed a git log command and gave Paul bad information about no commits. Indeed there are fixes in the 1.1 release branch.

#git log release11  --oneline | grep Item10927
482eed7 Item10927: perltidy
6526d15 Item10927: Don't use Foswiki::Meta->new() unless you mean it
37cd2e5 Item10927: perltidy
7814e55 Item10927: Fix destruction of meta when you update attach props
4057d16 Item10927: make perlcritic happy
edc4d22 Item10927: perltidy
e09fdc9 Item10927: Make unit test fail to highlight the problem

-- GeorgeClark - 02 Oct 2011
 
Topic revision: r24 - 17 Dec 2011, 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