Repository navigation
Keep a WebDAV base path from being repeated in collection requests - #1240
Merged
Merged
Conversation
Signed-off-by: dada-yan <BinjunYann@gmail.com>
WaylandYang
approved these changes
Oct 16, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thank you, this matches what Nextcloud sends: hrefs are absolute paths that already contain the base's path, so appending them to the base repeated it, and the collection's own entry was queued again and 404'd. Stripping only at a segment boundary and comparing request paths in their escaped form keeps %-escapes and the existing proxy key shape intact. The fixture across the four href shapes is a good guard.
Two small things for a follow-up if you like: the note on why the proxy case falls back to the URL's path was lost, and a line on why the self-entry check compares both the identity and the request path would help (proxy identities keep the prefix, the root's identity does not). Thanks again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A WebDAV base URL such as
https://cloud.example.com/remote.php/dav/files/alicealready contains a path prefix. When the server returns/remote.php/dav/files/alice/docs/a.txt, the client appends that entire path to the base again. Files are skipped after a 404, or a collection's own entry is revisited and the sync fails.What changes
Strip the configured base pathname from path-absolute and proxy-rewritten hrefs at path-segment boundaries. Use the request path as well as the document identity to recognize a collection's own entry, while keeping URL escapes and existing document identity formats.
Extend the existing HTTP fixture with prefixed path, absolute URL and proxy URL cases. It checks nested traversal, collection self-entries, escaped filenames, document identities and the exact request sequence. A small unit test protects prefix boundaries such as
aliceversusalice2.How it was checked
macOS arm64, Rust 1.98.1, commit
74b4b131based ondevat70bf7a7f:cargo +1.98.1 fmt --all --checkcargo +1.98.1 clippy --locked --offline --workspace --all-targets -- -D warningscargo +1.98.1 test --locked --offline --workspace: 1,534 reported passed, 0 failed, 6 ignored.devproduction code: it fails with a duplicated-path PROPFIND 404. It passes with the fix.Database-backed tests skip locally because
UTOPIA_DATABASE_URLis unset; the optional real-WebDAV smoke test also skips without its endpoint. The regression uses a local HTTP server and runs in the normal workspace suite.Before review
git commit -s).