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 4f6a28452a Additional fix for BZ 69362
4f6a28452a is described below
commit 4f6a28452a6f2f312d7218c402c618015276b0b4
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 3 17:04:09 2024 +0100
Additional fix for BZ 69362
https://bz.apache.org/bugzilla/show_bug.cgi?id=69362
---
java/org/apache/catalina/servlets/WebdavServlet.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 89c9bbf08e..1b72342a47 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1716,7 +1716,21 @@ public class WebdavServlet extends DefaultServlet
implements PeriodicEventListen
deleteCollection(req, path, errorList);
if (!resource.delete()) {
- errorList.put(path,
Integer.valueOf(WebdavStatus.SC_METHOD_NOT_ALLOWED));
+ /*
+ * 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 (resources.list(path).length == 0) {
+ /*
+ * The resource could not be deleted. 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(path,
Integer.valueOf(WebdavStatus.SC_METHOD_NOT_ALLOWED));
+ }
}
if (!errorList.isEmpty()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]