Item9352: Foswiki::Func::attachmentExists returns true when it is present in meta but not on disk

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: AndrewJones
Waiting For:
Last Change By: CrawfordCurrie
I would have been expecting it to be false, unless the attachment is actually there on the disk.

-- AndrewJones - 19 Jul 2010

$meta->testAttachment("testfile.txt", 'e') does do what I expected. I guess we need to check how Foswiki::Func::attachmentExists worked in 1.0

-- AndrewJones - 19 Jul 2010

As far as Foswiki is concerned, the "existence" of an attachment is dictated by the presence (or otherwise) of meta. If someone comes along and corrupts the database by deleting a file, then there might need to be an update of some kind c.f. autoattachpubfiles. But otherwise, the meta-data is the font of knowledge.

I would be bothered if the meta says the attachment exists, but the other methods then refuse to work with it because there is no file on disk, however.

-- CrawfordCurrie - 19 Jul 2010

The issue I have is the change in behaviour, and whether its important.

I have checked in unit tests to 01x00 and trunk. On 01x00, test_attachmentExistsInMetaOnly passes. It fails on trunk.

I am not sure if the behaviour for this function needs to stay the same. If it doesn't matter then we can just change the unit test.

-- AndrewJones - 19 Jul 2010

Well, from a compatibility perspective, it has to remain the same. From a logical perspective, it means that attachments might be incorrectly removed from a topic because they don't exist in store, which can be confusing. I have changed the behaviour back to require a store presence; but we're going to have to watch it carefully in case something else is (re)broken.

-- CrawfordCurrie - 20 Jul 2010

Removed the test as well

-- CrawfordCurrie - 23 Jul 2010

 

ItemTemplate edit

Summary Foswiki::Func::attachmentExists returns true when it is present in meta but not on disk
ReportedBy AndrewJones
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins Rev 8241 not found distro:813953497a0a Rev 8243 not found distro:b5a4673f52b5 distro:5dab6f66a2b0
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r12 - 23 Jul 2010, CrawfordCurrie
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