Skip to content

Keep XML references from truncating WebDAV file paths - #765

Open
Maya-Kid wants to merge 1 commit into
deeplethe:devfrom
Maya-Kid:codex/fix-webdav-xml-href
Open

Maya-Kid wants to merge 1 commit into
deeplethe:devfrom
Maya-Kid:codex/fix-webdav-xml-href

Conversation

@Maya-Kid

Copy link
Copy Markdown
Contributor

Problem

A WebDAV file named A&B.txt can be silently skipped during synchronization. A valid PROPFIND response represents its path as /docs/A&B.txt. quick-xml emits text, a reference, and more text separately, but the parser overwrites href on every text event and ignores references. The resulting path is only B.txt; the subsequent GET targets /B.txt and a 404 is treated as an unreadable file.

Change

Accumulate text, character/entity references, and CDATA until the field closes, then interpret href, content length, and last-modified values. Percent decoding runs after the full href is assembled. Whitespace is trimmed at field boundaries rather than between XML fragments. Unknown properties remain ignored; no new dependency or API/schema change.

Reproduction and validation

Base: 816d4a39255b68849d9eecaf273ec32b3f7d793d (dev).

  • Parser regression covers &, decimal/hex character references, CDATA, and mixed text/CDATA. On baseline the href is B.txt instead of /docs/A&B.txt.
  • End-to-end regression invokes the real fetch against a local HTTP fixture: the original implementation returns zero files; the fixed implementation downloads the expected file and retains its filename, bytes, and external key.
  • Before: 2 regression failures, 4 existing tests passed. After: all 6 passed.
  • cargo +1.98.1 test -p utopia-server --locked webdav::tests:: -- --skip it_reads_from_a_real_webdav_server
  • Workspace cargo fmt --all --check and cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • git diff --check: passed.

The optional externally configured WebDAV server test was explicitly excluded; the local HTTP integration test did run. No existing deployment, credentials, or database were used. Full workspace runtime tests were not repeated for this patch.

Signed-off-by: dada-yan <BinjunYann@gmail.com>
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