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

michaelo 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 d975c2b0f1 BZ 69360: Inconsistent DELETE behavior between 
DefaultServlet and WebdavServlet
d975c2b0f1 is described below

commit d975c2b0f1e17e4756933037f7dd834f82254a13
Author: Michael Osipov <micha...@apache.org>
AuthorDate: Wed Oct 2 11:04:44 2024 +0200

    BZ 69360: Inconsistent DELETE behavior between DefaultServlet and 
WebdavServlet
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 6 +++---
 webapps/docs/changelog.xml                           | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 7845f37ec4..7c871b2317 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1694,7 +1694,7 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
         if (!resource.isDirectory()) {
             if (!resource.delete()) {
-                resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
+                resp.sendError(WebdavStatus.SC_METHOD_NOT_ALLOWED);
                 return false;
             }
         } else {
@@ -1703,7 +1703,7 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
             deleteCollection(req, path, errorList);
             if (!resource.delete()) {
-                errorList.put(path, 
Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+                errorList.put(path, 
Integer.valueOf(WebdavStatus.SC_METHOD_NOT_ALLOWED));
             }
 
             if (!errorList.isEmpty()) {
@@ -1770,7 +1770,7 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
                     if (!childResource.isDirectory()) {
                         // If it's not a collection, then it's an unknown
                         // error
-                        errorList.put(childName, 
Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+                        errorList.put(childName, 
Integer.valueOf(WebdavStatus.SC_METHOD_NOT_ALLOWED));
                     }
                 }
             }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a9971af3e1..51d0bf6233 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -147,6 +147,11 @@
         <code>getRelativePath()</code> method from super class with
         incorrect Javadoc. (michaelo)
       </fix>
+      <fix>
+        <bug>69360</bug>: Inconsistent <code>DELETE</code> behavior between
+        <code>WebdavServlet</code> and <code>DefaultServlet</code>.
+        (michaelo)
+      </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

Reply via email to