fix(webdav): fall back to Depth:1 recursion when PROPFIND infinity returns HTTP 500 (BIT-33518) #7

Merged
bug-squasher merged 1 commits from task/BIT-33518-webdav-propfind-500 into main 2026-11-29 01:18:42 +00:00
Member

Root cause

list_files issued a PROPFIND with Depth: infinity. Many WebDAV servers (Nextcloud, ownCloud, Apache mod_dav with infinite depth disabled) reject infinite-depth PROPFIND with HTTP 500 (also 403/501), which surfaced as WebdavError: PROPFIND failed: HTTP 500 and stalled the sync for the affected account.

Fix

When Depth: infinity returns 500/403/501, list_files now falls back to a recursive Depth: 1 traversal of child collections. Relative paths are still computed against the original root URL, so year-folder filtering (webdav_file_matches_min_year) and dedup keys (get_webdav_message_key) keep working for nested files.

Tests

  • test_parse_propfind_collections_skips_root — child collection parser ignores the root entry.
  • test_list_files_falls_back_to_depth_one_on_http_500 — infinity returns 500, Depth:1 recursion recovers files from the root and a subfolder; nested file keeps 2025/receipt.pdf relative path and passes year filtering.
  • test_list_files_still_raises_on_persistent_500 — a 500 that persists through the fallback still surfaces as WebdavError.

All 12 webdav tests pass; collectable suite (27 tests) green.

BIT-33518
Paperclip-Ref: BIT-33518

## Root cause `list_files` issued a `PROPFIND` with `Depth: infinity`. Many WebDAV servers (Nextcloud, ownCloud, Apache mod_dav with infinite depth disabled) reject infinite-depth PROPFIND with **HTTP 500** (also 403/501), which surfaced as `WebdavError: PROPFIND failed: HTTP 500` and stalled the sync for the affected account. ## Fix When `Depth: infinity` returns 500/403/501, `list_files` now falls back to a recursive `Depth: 1` traversal of child collections. Relative paths are still computed against the original root URL, so year-folder filtering (`webdav_file_matches_min_year`) and dedup keys (`get_webdav_message_key`) keep working for nested files. ## Tests - `test_parse_propfind_collections_skips_root` — child collection parser ignores the root entry. - `test_list_files_falls_back_to_depth_one_on_http_500` — infinity returns 500, Depth:1 recursion recovers files from the root and a subfolder; nested file keeps `2025/receipt.pdf` relative path and passes year filtering. - `test_list_files_still_raises_on_persistent_500` — a 500 that persists through the fallback still surfaces as `WebdavError`. All 12 webdav tests pass; collectable suite (27 tests) green. BIT-33518 Paperclip-Ref: BIT-33518
bug-squasher added 1 commit 2026-11-29 01:17:59 +00:00
Some WebDAV servers (Nextcloud, ownCloud, Apache mod_dav with infinite
depth disabled) reject Depth:infinity PROPFIND with HTTP 500/403/501.
list_files now retries with a recursive Depth:1 traversal of child
collections, preserving full relative paths for year-folder filtering
and dedup keys.

BIT-33518
Paperclip-Ref: BIT-33518
bug-squasher merged commit f39338a2a9 into main 2026-11-29 01:18:42 +00:00
Sign in to join this conversation.