fix(webdav): include fileid in find_by_type SEARCH + address PR #765 review

The default property set in `search_files` omits `<oc:fileid>`, so
`find_by_type` returned descendant dicts with no `file_id` — which
`NextcloudClient.find_files_by_tag` then silently dropped via its
dedup-by-id guard. Net effect: tag-on-folder produced zero expanded
descendants in CI (single-user / nc31, nc32). Mirrors the explicit
property list already used in `WebDAVClient.find_by_tag`.

Also addresses three nits from the PR #765 bot review:
- trim multi-paragraph docstring on `_normalise_search_result`
- trim multi-line docstring on `find_files_by_tag`
- match `is not None` ID-extraction pattern in the descendant loop
- assert positional `mime_type` arg in the unit test

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-05-07 01:41:35 +02:00
co-authored by Claude Opus 4.7
parent 43c6788555
commit e9e6bcc60a
3 changed files with 29 additions and 51 deletions
+5 -3
View File
@@ -172,10 +172,12 @@ class TestFindFilesByTag:
for f in result:
assert f["path"].startswith("/")
assert f["last_modified_timestamp"] is not None
# SEARCH was scoped to the tagged folder (no leading slash).
# SEARCH was scoped to the tagged folder (no leading slash) and
# forwarded the requested MIME type as the positional first arg.
client.webdav.find_by_type.assert_awaited_once()
call_kwargs = client.webdav.find_by_type.await_args.kwargs
assert call_kwargs["scope"] == "corpus"
call_args = client.webdav.find_by_type.await_args
assert call_args.args[0] == "application/pdf"
assert call_args.kwargs["scope"] == "corpus"
async def test_dedupes_when_file_directly_tagged_and_under_tagged_folder(self):
client = _make_client()