This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 1cb857d4f2 Fix BZ 69362 - Better multi-status response for deletes
1cb857d4f2 is described below
commit 1cb857d4f246e8245e52284b54a514cbdd3df51b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 3 11:25:47 2024 +0100
Fix BZ 69362 - Better multi-status response for deletes
---
java/org/apache/catalina/servlets/WebdavServlet.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java
b/java/org/apache/catalina/servlets/WebdavServlet.java
index c5ad3f8623..2065add225 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1780,9 +1780,19 @@ public class WebdavServlet extends DefaultServlet
implements PeriodicEventListen
}
if (!childResource.delete()) {
- if (!childResource.isDirectory()) {
- // If it's not a collection, then it's an unknown
- // error
+ /*
+ * See RFC 4918, section 9.6.1, last paragraph.
+ *
+ * If a child resource can't be deleted then the parent
resource SHOULD NOT be included in the
+ * multi-status response since the notice of the failure
to delete the child implies that all
+ * parent resources could also not be deleted.
+ */
+ if (!childResource.isDirectory() ||
resources.list(childName).length == 0) {
+ /*
+ * The resource could not be deleted. If the resource
is not a directory or if the resource is a
+ * directory and it has no children (or all those
children have been successfully deleted) then
+ * it should be listed in the multi-status response.
+ */
errorList.put(childName,
Integer.valueOf(WebdavStatus.SC_METHOD_NOT_ALLOWED));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]