This is an automated email from the ASF dual-hosted git repository. Xuanwo pushed a commit to branch xuanwo/webdav-native-recursive-delete in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 01ec0266a5a8c8df89d42ffd6f95185a7982159e Author: Xuanwo <[email protected]> AuthorDate: Sun Nov 22 21:51:36 2026 +0100 feat(services/webdav): support native recursive delete Per RFC 4918 9.6.1, a WebDAV DELETE on a collection always acts as Depth: infinity, and clients must not send Depth: 0 or 1. The service already sends a single DELETE for directory deletes, so advertising delete_with_recursive lets recursive deletes go straight to the wire instead of simulating a client-side walk. Refs #3922 --- core/services/webdav/src/backend.rs | 1 + core/services/webdav/src/docs.md | 28 ++++++++++++++++++++++++---- website/data/capabilities.json | 1 + 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/core/services/webdav/src/backend.rs b/core/services/webdav/src/backend.rs index dd8fcb0756..bbda4930a9 100644 --- a/core/services/webdav/src/backend.rs +++ b/core/services/webdav/src/backend.rs @@ -235,6 +235,7 @@ impl Builder for WebdavBuilder { create_dir: true, delete: true, + delete_with_recursive: true, delete_with_if_match: true, copy: true, diff --git a/core/services/webdav/src/docs.md b/core/services/webdav/src/docs.md index f88f842196..0a15557bcf 100644 --- a/core/services/webdav/src/docs.md +++ b/core/services/webdav/src/docs.md @@ -51,10 +51,30 @@ level. [Server compatibility reports](https://github.com/apache/opendal/issues/4 Set `disable_depth_infinity = true` for these endpoints. The default `auto-simulate` feature installs `SimulateLayer`, which walks the directory -tree with `Depth: 1` requests for recursive listing and deletion. If you -build without `auto-simulate`, add `SimulateLayer::default()` to the operator -to enable the walk. With native recursion disabled and no simulation, -recursive listing returns `ErrorKind::Unsupported`. +tree with `Depth: 1` requests for recursive listing. If you build without +`auto-simulate`, add `SimulateLayer::default()` to the operator to enable the +walk. With native recursion disabled and no simulation, recursive listing +returns `ErrorKind::Unsupported`. + +The option only controls recursive `PROPFIND`. Deleting a directory is always +a single recursive `DELETE` (see below). + +### Recursive delete + +Per [RFC 4918 ยง9.6.1](https://datatracker.ietf.org/doc/html/rfc4918#section-9.6.1), +a WebDAV `DELETE` on a collection always acts as `Depth: infinity`: the +server removes the collection and every member in one request, and clients +must not send `Depth: 0` or `Depth: 1`. OpenDAL sends one `DELETE` for +`delete("dir/")` and for `delete_with("dir/").recursive(true)`; there is no +client-side traversal. `disable_depth_infinity` does not affect this. + +This means a non-recursive `delete("dir/")` also removes the directory's +contents, and `delete_with("/").recursive(true)` targets the configured root. + +When the server cannot remove every member, it answers `207 Multi-Status` +with per-resource failures, for example on a locked or read-only subtree. +OpenDAL reports that response as an error while some descendants may already +have been deleted. ```rust,no_run use opendal_core::{Operator, Result}; diff --git a/website/data/capabilities.json b/website/data/capabilities.json index cb79424b62..ecd8148509 100644 --- a/website/data/capabilities.json +++ b/website/data/capabilities.json @@ -2180,6 +2180,7 @@ "create_dir": true, "delete": true, "delete_with_if_match": true, + "delete_with_recursive": true, "list": true, "list_with_recursive": "When `disable_depth_infinity` is disabled", "read": true,
