Foswiki on GitHub is open for business! Next release meeting: Monday September 15, 1300Z

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

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine QUERY  
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
 

ItemTemplate edit

Summary QUERY referencing the attachment fields can't access attachment 0 when there is only one attachment
ReportedBy GeorgeClark NigelWinterbottom
Codebase 1.1.5 RC1, 1.1.4
SVN Range
AppliesTo Engine
Component QUERY
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:14564 Foswikirev:14566 Foswikirev:14567 Foswikirev:14568 Foswikirev:14569
TargetRelease patch
ReleasedIn 1.1.5
CheckinsOnBranches Release01x01 trunk
trunkCheckins Foswikirev:14566 Foswikirev:14569
Release01x01Checkins Foswikirev:14564 Foswikirev:14567 Foswikirev:14568
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 CopyrightStatement. Creative Commons License