Skip to content

fix: list contacts on servers that reject a bare prop-filter - #3

Open
janbaer wants to merge 2 commits into
dominik1001:claude/beautiful-carson-4lqy46from
janbaer:fix/list-contacts-propfind
Open

fix: list contacts on servers that reject a bare prop-filter#3
janbaer wants to merge 2 commits into
dominik1001:claude/beautiful-carson-4lqy46from
janbaer:fix/list-contacts-propfind

Conversation

@janbaer

@janbaer janbaer commented Aug 16, 2026

Copy link
Copy Markdown

list-contacts returns an empty array against Open-Xchange (mailbox.org), even though the address book holds contacts and list-address-books works.

fetchVCards discovers the card hrefs with an addressbook-query whose default filter is a condition-less <prop-filter name="FN"/>. Sending the same REPORT by hand against a book holding 24 cards:

filter vCards returned
none 24
<prop-filter name="FN"/> 0
<prop-filter name="FN"> + <text-match> 4
<filter/> 24

RFC 6352 reads a bare prop-filter as "every card carrying that property", so this looks like a server bug, but it is one that any tsdav-based client walks into. The href list comes back empty, the multi-get stage never runs, and the tool reports zero contacts.

This discovers the hrefs with a PROPFIND and hands them to fetchVCards as objectUrls, which takes the addressbook-multiget path and skips the filter. resolve-contact already does exactly this, which is why get-contact worked while list-contacts did not.

Verified against mailbox.org. Four unit tests added, full suite green.

One aside: this repository's default branch on GitHub is claude/beautiful-carson-4lqy46, one commit ahead of main, so I based the PR there. Let me know if you would rather have it on main.

fetchVCards discovers the card hrefs with an addressbook-query whose default
filter is a condition-less <prop-filter name="FN"/>. RFC 6352 reads that as
"every card carrying an FN property", but Open-Xchange answers it with an
empty result. The collection then looks empty, the multi-get stage never
runs, and list-contacts reports zero contacts for a populated address book.
mailbox.org is one affected host.

Discover the hrefs with a PROPFIND and hand them to fetchVCards as
objectUrls, which routes the fetch through addressbook-multiget and skips the
filter entirely. PROPFIND is mandatory for a CardDAV collection, so this
works everywhere; resolve-contact already takes the same objectUrls path,
which is why get-contact kept working while list-contacts did not.
@janbaer
janbaer marked this pull request as draft August 16, 2026 15:39
PROPFIND returns the collection itself alongside its members, and that entry
was recognised by comparing paths for exact equality. Servers differ on
whether they put a trailing slash there, and it need not match the one the
caller passed in, so the collection could survive into the href list and be
requested as if it were a card. Harmless downstream, since a response without
vCard data is filtered out anyway, but it defeats the empty-collection short
circuit and it is the same trailing-slash fragility that hrefFor already
guards against elsewhere in this repo.
@janbaer

janbaer commented Aug 16, 2026

Copy link
Copy Markdown
Author

Pushed one follow-up: the self-filter compared paths for exact equality, so a collection whose own href carries a trailing slash the caller did not pass would survive into the href list and be requested as if it were a card. Harmless downstream, since a response without vCard data is filtered out anyway, but it defeats the empty-collection short circuit and it is the same trailing-slash fragility hrefFor already guards against elsewhere in this repo. Both sides are normalised now, with a test for the mismatch.

@janbaer
janbaer marked this pull request as ready for review August 16, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant