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

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


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

commit ade2480f128525d32189055ea936552437c1c8af
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 1555c8d37a..2ddbd66ed8 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1713,7 +1713,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