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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new f6037c3344 Fix directory listings
f6037c3344 is described below

commit f6037c334499176068091f3931cbec9ecf30748b
Author: remm <r...@apache.org>
AuthorDate: Mon Oct 21 13:25:55 2024 +0200

    Fix directory listings
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 73fd903bae..cfcbabe262 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -530,6 +530,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
      * normal viewing.
      *
      * @param request The servlet request we are processing
+     * @param allowEmptyPath Used only to identify a call from DefaultServlet, 
to avoid removing the trailing slash
+     * @return the relative path
      */
     @Override
     protected String getRelativePath(HttpServletRequest request, boolean 
allowEmptyPath) {
@@ -550,7 +552,7 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
             result.append('/');
         }
         String resultString = result.toString();
-        if (resultString.length() > 1 && resultString.endsWith("/")) {
+        if (!allowEmptyPath && resultString.length() > 1 && 
resultString.endsWith("/")) {
             resultString = resultString.substring(0, resultString.length() - 
1);
         }
         return resultString;


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

Reply via email to