This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new e663e76dc1 feat(services/webdav): support native recursive delete
(#8725)
e663e76dc1 is described below
commit e663e76dc1304fb95740bfdab33d8096a859de84
Author: Xuanwo <[email protected]>
AuthorDate: Mon Nov 23 05:27:38 2026 +0800
feat(services/webdav): support native recursive delete (#8725)
* 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
* docs(services/webdav): keep disable_depth_infinity example under
recursive listing
Move the Recursive delete section after the disable_depth_infinity code
example so the example stays with Recursive listing, and assert in the
backend tests that disabling depth infinity keeps delete_with_recursive.
Refs #3922
---
core/services/webdav/src/backend.rs | 5 +++++
core/services/webdav/src/docs.md | 26 ++++++++++++++++++++++----
website/data/capabilities.json | 1 +
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/core/services/webdav/src/backend.rs
b/core/services/webdav/src/backend.rs
index dd8fcb0756..b40caff47e 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,
@@ -459,6 +460,7 @@ mod tests {
};
assert!(service.capability().list_with_recursive);
+ assert!(service.capability().delete_with_recursive);
assert!(
service
.list(&OperationContext::default(), "/", args.into())
@@ -480,6 +482,9 @@ mod tests {
};
assert!(!service.capability().list_with_recursive);
+ // `disable_depth_infinity` only controls recursive `PROPFIND`;
+ // collection `DELETE` stays recursive per RFC 4918 §9.6.1.
+ assert!(service.capability().delete_with_recursive);
let err = service.list(&ctx, "/", args.into()).err().unwrap();
assert_eq!(err.kind(), ErrorKind::Unsupported);
assert!(service.list(&ctx, "/", OpList::default()).is_ok());
diff --git a/core/services/webdav/src/docs.md b/core/services/webdav/src/docs.md
index f88f842196..9bb2d44d7d 100644
--- a/core/services/webdav/src/docs.md
+++ b/core/services/webdav/src/docs.md
@@ -51,10 +51,10 @@ 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`.
```rust,no_run
use opendal_core::{Operator, Result};
@@ -70,6 +70,24 @@ let op = Operator::new(
# }
```
+### 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` only controls recursive
+`PROPFIND` and 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.
+
### Conditional writes
OpenDAL sends write preconditions on the PUT that writes the destination file.
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,