This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 5b73427c4b Additional fix for BZ 69362
5b73427c4b is described below

commit 5b73427c4b66da3505a7a3659193c69a2d27e697
Author: Mark Thomas <ma...@apache.org>
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 9de0144ef6..dcf7aee188 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1714,7 +1714,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: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to