Radicale icon indicating copy to clipboard operation
Radicale copied to clipboard

Erroneous evaluation of negated text-match filter

Open mstilkerich opened this issue 5 years ago • 0 comments

If a prop-filter includes a negated text-match filter, a card that has a property that matches the non-negated text-match filter but also has another property that matches the negated text-match filter is filtered out. However, it should be returned.

Example report:

<?xml version="1.0"?>
<CARDDAV:addressbook-query xmlns:DAV="DAV:" xmlns:CARDDAV="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
 <DAV:prop>
  <DAV:getetag/>
  <CARDDAV:address-data/>
 </DAV:prop>
 <CARDDAV:filter test="anyof">
  <CARDDAV:prop-filter name="EMAIL" test="anyof">
   <CARDDAV:text-match negate-condition="yes" collation="i;unicode-casemap" match-type="contains">@example.com</CARDDAV:text-match>
  </CARDDAV:prop-filter>
 </CARDDAV:filter>
</CARDDAV:addressbook-query>

And an example VCard:

BEGIN:VCARD                                                                                                                 
VERSION:4.0                                                                                                                 
PRODID:-//Sabre//Sabre VObject 4.3.3//EN                                                                                    
UID:sabre-vobject-ae3f586e-aabc-410e-beb7-b82bd74f1abf                                                                      
EMAIL;TYPE=WORK:[email protected]                                                                                                
EMAIL;TYPE=HOME:[email protected]                                                                                         
FN:CardDavClient Test726906289                                                                                              
N:Test726906289;CardDavClient;;;                                                                                            
NICKNAME:Jonny0                                                                                                             
END:VCARD  

This card should match the filter (because the work email address property matches), but radicale sorts it out.

mstilkerich avatar Jan 23 '21 17:01 mstilkerich