Skip to content

fix(sync): tolerate existing WebDAV dirs after MKCOL auth errors#445

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-webdav-existing-dir-mkcol
Open

fix(sync): tolerate existing WebDAV dirs after MKCOL auth errors#445
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-webdav-existing-dir-mkcol

Conversation

@codedogQBY

Copy link
Copy Markdown
Owner

Analysis

Issue #206 shows iPad WebDAV sync failing even though the same WebDAV account works on Android. The diagnostic log has a key pattern:

  • PROPFIND / succeeds with 207, so credentials and the server URL are valid.
  • The next MKCOL /readany returns 401, which aborts directory setup.

Some WebDAV servers are inconsistent around MKCOL for directories that already exist or are visible through the parent listing. Treating that response as a hard auth failure blocks sync even when the target collection is already present.

Changes

  • When MKCOL fails or returns 401 / 403, re-check whether the collection already exists.
  • Keep the existing fast PROPFIND Depth: 0 check, and add a parent-directory listing fallback for servers that refuse direct collection probes but expose the child in the parent listing.
  • Continue only when the collection is proven to exist; genuinely missing or inaccessible directories still fail.
  • Add regression coverage for the [Bug] webdav在pad401 #206 shape: direct /readany/ probe misses, MKCOL /readany/ returns 401, parent / listing includes /readany/, and ensureDirectory() proceeds.

Verification

  • pnpm --filter @readany/core test -- webdav-client
  • pnpm --filter @readany/core exec tsc --noEmit
  • pnpm exec biome check packages/core/src/sync/webdav-client.ts packages/core/src/sync/webdav-client.test.ts
  • git diff --check

Fixes #206

@codedogQBY codedogQBY added bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression area:sync Sync, WebDAV, S3, remote storage area:mobile Mobile, tablet, React Native, Android, iOS labels Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:mobile Mobile, tablet, React Native, Android, iOS area:sync Sync, WebDAV, S3, remote storage bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] webdav在pad401

1 participant