Item11730: QUERY referencing the attachment fields can't access attachment 0 when there is only one attachment

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component: QUERY
Branches: Release01x01 trunk
Reported By: GeorgeClark NigelWinterbottom
Waiting For:
Last Change By: NigelWinterbottom
Cloned from Item11502, which was describing two separate problems


I'm running "Foswiki version Foswiki-1.1.4, Tue, 20 Dec 2011, build 13483, Plugin API version 2.1" I have a similar issue:
 %QUERY{"'TopicWithOneAttachment'/attachments[0].comment"}% 
Returns the string "comment" instead of the actual comment. When there is more than one attachment in the source topic however, the above works correctly.

-- NigelWinterbottom - 13 Mar 2012

The changes were minimal (a single line)
www-data@foswiki:/var/www/foswiki/lib/Foswiki/Query$ diff OP_where.pm /home/foswiki/OP_where.pm
48c48
<         return $b->evaluate( data => $lval, tom => $domain{tom} );
---
>         return $b->evaluate( data => $lval, tom => $domain{tom} ) ? $lval : [];
I replaced the file and have to report that the above example still does not work; it returns a null string instead of the actual comment.

I tried OP_where.pm & OP.pm from trunk and can report that the above example does work as expected.

Flipping CurrentState back to New because this Item is not fixed in Foswiki 1.1.5

-- NigelWinterbottom - 26 Mar 2012

Confirmed - this is still broken on 1.1.5RC2.

-- GeorgeClark - 05 Apr 2012

Fixed this case too. Nigel, try this version of OP_where.pm:

http://trac.foswiki.org/browser/branches/Release01x01/core/lib/Foswiki/Query/OP_where.pm?rev=14567#L27

-- KipLubliner - 06 Apr 2012

After returning from Easter Hols and celebrating my birthday on the 10th, I discovered Foswiki 1.1.5 had been already released, so I upgraded and tested that instead.of the files in branch.

I can now happlily report this issue is fixed.

-- NigelWinterbottom - 12 Apr 2012
 
Topic revision: r10 - 12 Apr 2012, NigelWinterbottom
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