Skip to content

Commit 0eec770

Browse files
committed
more compatibility problems
1 parent 0791c71 commit 0eec770

3 files changed

Lines changed: 52 additions & 10 deletions

File tree

caldav/compatibility_hints.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,9 @@ def dotted_feature_set_list(self, compact=False):
953953
'sync-token': {'support': 'fragile'},
954954
#'search.text': 'unsupported', ## weeeird ... it wasn't like this before
955955
'search.is-not-defined': {'support': 'unsupported'},
956-
'search.text.substring': {'support': 'unsupported'},
957-
'search.text.category': {'support': 'ungraceful'},
956+
'search.text': {'support': 'unsupported'},
958957
'search.recurrences.expanded.todo': { "support": "unsupported" },
959958
'search.comp-type-optional': {'support': 'fragile'}, ## TODO: more research on this, looks like a bug in the checker,
960-
'search.text.case-sensitive': {'support': 'unsupported'},
961-
'search.text.case-insensitive': {'support': 'unsupported'},
962959
'search.time-range.alarm': {'support': 'unsupported'},
963960
'principal-search': "unsupported",
964961

@@ -1354,15 +1351,16 @@ def dotted_feature_set_list(self, compact=False):
13541351
],
13551352
}
13561353

1354+
## Lots of transient problems with purelymail
13571355
purelymail = {
13581356
## Purelymail claims that the search indexes are "lazily" populated,
13591357
## so search works some minutes after the event was created/edited.
13601358
'search-cache': {'behaviour': 'delay', 'delay': 18},
1361-
## woot?
1362-
#"create-calendar.auto": {"support": "full"},
1359+
## Hmmm .... weird, this is flapping in the caldav-server-tester?
1360+
"create-calendar.auto": {"support": "full"},
13631361
## 409 Conflict with <must-have-parent> when PUTting to a URL not under an existing calendar
13641362
#'save-load.get-by-url': {'support': 'unknown'},
1365-
'save-load.todo': {'support': 'ungraceful'},
1363+
#'save-load.todo': {'support': 'ungraceful'},
13661364
'search.comp-type-optional': {'support': 'ungraceful'},
13671365
## The search features below are unreliable on purelymail, likely due
13681366
## to the 160s search-cache delay. Results flip between unsupported
@@ -1374,8 +1372,7 @@ def dotted_feature_set_list(self, compact=False):
13741372
'search.time-range.event': {'support': 'fragile'},
13751373
## was: ungraceful - observed unsupported 2026-02 (for .old-dates)
13761374
'search.time-range.todo': {'support': 'fragile'},
1377-
'search.text.case-sensitive': {'support': 'unsupported'},
1378-
'search.text.case-insensitive': {'support': 'unsupported'},
1375+
'search.text': {'support': 'unsupported'},
13791376
'search.text.category': {'support': 'unsupported'},
13801377
'search.recurrences.expanded': {'support': 'unsupported'},
13811378
'search.recurrences.includes-implicit': {'support': 'unsupported'},

caldav/search.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,29 @@ def _search_impl(
277277
if not self.start or not self.end:
278278
raise error.ReportError("can't expand without a date range")
279279

280+
## special compatibility-case for servers that do not support text search at all
281+
## (e.g. purelymail where both i;octet and i;ascii-casemap collations are unsupported).
282+
## Remove all text-value filters and rely on client-side post_filter instead.
283+
if (
284+
not calendar.client.features.is_supported("search.text")
285+
and self._property_filters
286+
and post_filter is not False
287+
):
288+
text_filter_props = [
289+
prop for prop, op in self._property_operator.items() if op != "undef"
290+
]
291+
if text_filter_props:
292+
clone = self._clone_without_filters(text_filter_props)
293+
objects = yield (
294+
SearchAction.RECURSIVE_SEARCH,
295+
(clone, calendar, server_expand, split_expanded, props, xml, None, None),
296+
)
297+
yield (
298+
SearchAction.RETURN,
299+
self.filter(objects, post_filter, split_expanded, server_expand),
300+
)
301+
return
302+
280303
## special compatbility-case for servers that does not
281304
## support category search properly
282305
if (
@@ -486,6 +509,28 @@ def _search_impl(
486509
yield (SearchAction.RETURN, result)
487510
return
488511

512+
## If _hacks=="insist" and still no results despite having text property
513+
## filters, the server may not support text search (e.g. purelymail,
514+
## CCS with i;octet collation). Retry without the text filters and rely
515+
## on client-side post_filter (which is guaranteed True in get_object_by_uid).
516+
if not objects and _hacks == "insist" and self._property_filters:
517+
non_undef_filters = [
518+
prop
519+
for prop, op in self._property_operator.items()
520+
if op != "undef"
521+
]
522+
if non_undef_filters:
523+
clone = self._clone_without_filters(non_undef_filters)
524+
result = yield (
525+
SearchAction.RECURSIVE_SEARCH,
526+
(clone, calendar, server_expand, split_expanded, props, orig_xml, None, None),
527+
)
528+
yield (
529+
SearchAction.RETURN,
530+
self.filter(result, post_filter, split_expanded, server_expand),
531+
)
532+
return
533+
489534
# Post-process: load objects
490535
obj2 = []
491536
for o in objects:

tests/docker-test-servers/ccs/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- ./conf:/opt/ccs/conf:ro
99
command: ./bin/run -n -c /opt/ccs/conf/caldavd.plist
1010
tmpfs:
11-
- /opt/ccs/data:size=200m
11+
- /opt/ccs/data:size=200m,uid=1001,gid=1001
1212
healthcheck:
1313
test: ["CMD", "curl", "-f", "http://localhost:8008/"]
1414
interval: 10s

0 commit comments

Comments
 (0)