From dev-return-188059-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Mon Jan 8 16:52:18 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id D98B4180607 for ; Mon, 8 Jan 2018 16:52:18 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C9263160C2C; Mon, 8 Jan 2018 15:52:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1A644160C1E for ; Mon, 8 Jan 2018 16:52:17 +0100 (CET) Received: (qmail 66379 invoked by uid 500); 8 Jan 2018 15:52:16 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 66369 invoked by uid 99); 8 Jan 2018 15:52:16 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2018 15:52:16 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 321173A00E6 for ; Mon, 8 Jan 2018 15:52:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1820576 - in /tomcat/trunk: java/org/apache/catalina/servlets/WebdavServlet.java webapps/docs/changelog.xml Date: Mon, 08 Jan 2018 15:52:16 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180108155216.321173A00E6@svn01-us-west.apache.org> Author: markt Date: Mon Jan 8 15:52:15 2018 New Revision: 1820576 URL: http://svn.apache.org/viewvc?rev=1820576&view=rev Log: 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. Modified: tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java?rev=1820576&r1=1820575&r2=1820576&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Mon Jan 8 15:52:15 2018 @@ -1742,19 +1742,23 @@ public class WebdavServlet extends Defau } } } + // 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)); + if (!resources.write(dest, is, false)) { + errorList.put(source, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); return false; } } catch (IOException e) { log(sm.getString("webdavservlet.inputstreamclosefail", source), e); } } else { - errorList.put(source, - Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); + errorList.put(source, Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); return false; } return true; Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1820576&r1=1820575&r2=1820576&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Jan 8 15:52:15 2018 @@ -67,6 +67,12 @@ setHeader() or addHeader() as well as when it is set via setContentType(). (markt) + + 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) + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org