This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 589c12d536 Fix BZ 69362 - Better multi-status response for deletes 589c12d536 is described below commit 589c12d536574e6a67391a00122b5b5442a1c236 Author: Mark Thomas <ma...@apache.org> 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 +++++++++++++--- webapps/docs/changelog.xml | 5 +++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index e7383cb176..611a85c88c 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -1778,9 +1778,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)); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index bd0cb5127d..a71809810a 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -160,6 +160,11 @@ Add log warning if non wildcard mappings are used with the <code>WebdavServlet</code>. (remm) </fix> + <fix> + <bug>69362</bug>: Provide a better multi-status response when deleting a + collection via WebDAV fails. Empty directories that cannot be deleted + will now be included in the response. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org