From 1545bcdbbaf11f9d67e2f5dc38e82628e64d3751 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 9 Mar 2022 11:15:38 -0500 Subject: [PATCH] fix(addressbook(dav)): improve handling of addressbook-query --- SOPE/GDLContentStore/EOQualifier+GCS.m | 2 +- SoObjects/Contacts/SOGoContactGCSFolder.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SOPE/GDLContentStore/EOQualifier+GCS.m b/SOPE/GDLContentStore/EOQualifier+GCS.m index 7c35930588..b8df73c3bc 100644 --- a/SOPE/GDLContentStore/EOQualifier+GCS.m +++ b/SOPE/GDLContentStore/EOQualifier+GCS.m @@ -136,7 +136,7 @@ - (void) _appendKeyValueQualifier: (EOKeyValueQualifier *) _q { if (_adaptor) { - // Assume qualifier applies to a varchar column type + // The value is a string, assume qualifier applies to a varchar column type attribute = [EOAttribute new]; [attribute setExternalType: @"varchar"]; [attribute autorelease]; diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index b40eb7cd3d..0669720c65 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -221,9 +221,9 @@ - (EOQualifier *) qualifierForFilter: (NSString *) filter qualifier = nil; if ([filter length] > 0) { - filter = [filter asSafeSQLLikeString]; + filter = [[filter asSafeSQLString] stringByReplacingString: @"\%" withString: @"%%"]; filters = [NSMutableArray array]; - filterFormat = [NSString stringWithFormat: @"(%%@ isCaseInsensitiveLike: '%%%%%@%%%%')", filter]; + filterFormat = [NSString stringWithFormat: @"(%%@ isCaseInsensitiveLike: '*%@*')", filter]; if (criteria) criteriaList = [criteria objectEnumerator]; else