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

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

commit 41ea8490b92499e32cc1392e9d53aa7db18ef1fc
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jan 8 15:52:15 2018 +0000

    When using WebDAV to copy a file resource to a destination that requires a 
collection to be overwritten, ensure that the operation succeeds rather than 
fails (with a 500 response). This enables Tomcat to pass two additional tests 
from the Litmus WebDAV test suite.
    
    git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1820576 
13f79535-47bb-0310-9956-ffa450edef68
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 7 +++++++
 webapps/docs/changelog.xml                           | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 1ad0f97..f820e7e 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1735,6 +1735,13 @@ public class WebdavServlet extends DefaultServlet {
                     }
                 }
             }
+            // WebDAV Litmus test attempts to copy/move a file over a 
collection
+            // Need to remove trailing / from destination to enable test to 
pass
+            if (!destResource.exists() && dest.endsWith("/") && dest.length() 
> 1) {
+                // Convert destination name from collection (with trailing '/')
+                // to file (without trailing '/')
+                dest = dest.substring(0, dest.length() - 1);
+            }
             try (InputStream is = sourceResource.getInputStream()) {
                 if (!resources.write(dest, is, false)) {
                     errorList.put(source, 
Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 793eb19..67ffece 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -59,6 +59,12 @@
         <code>Allow</code> header and a method listed in the <code>Allow</code>
         header will not return a 405 status code. (markt)
       </fix>
+      <fix>
+        When using WebDAV to copy a file resource to a destination that 
requires
+        a collection to be overwritten, ensure that the operation succeeds
+        rather than fails (with a 500 response). This enables Tomcat to pass 
two
+        additional tests from the Litmus WebDAV test suite. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to