You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2025/06/20 12:13:41 UTC

(tomcat) branch main updated: Allow trailing slash for webAppMount in Resources

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 4c688213d9 Allow trailing slash for webAppMount in Resources
4c688213d9 is described below

commit 4c688213d931a1979c9f2f0c5265dd87b32dca3b
Author: remm <re...@apache.org>
AuthorDate: Fri Jun 20 14:13:30 2025 +0200

    Allow trailing slash for webAppMount in Resources
    
    BZ69717
    Mostly for compatibility reasons as most paths are usually without a
    trailing slash, if it is not meaningful.
---
 java/org/apache/catalina/webresources/AbstractResourceSet.java     | 4 ++--
 test/org/apache/catalina/webresources/TestDirResourceSetMount.java | 2 +-
 webapps/docs/changelog.xml                                         | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/webresources/AbstractResourceSet.java b/java/org/apache/catalina/webresources/AbstractResourceSet.java
index 80961d738a..31d87d787d 100644
--- a/java/org/apache/catalina/webresources/AbstractResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractResourceSet.java
@@ -72,8 +72,8 @@ public abstract class AbstractResourceSet extends LifecycleBase implements WebRe
     public final void setWebAppMount(String webAppMount) {
         checkPath(webAppMount);
         // Optimise internal processing
-        if (webAppMount.equals("/")) {
-            this.webAppMount = "";
+        if (webAppMount.endsWith("/")) {
+            this.webAppMount = webAppMount.substring(0, webAppMount.length() - 1);
         } else {
             this.webAppMount = webAppMount;
         }
diff --git a/test/org/apache/catalina/webresources/TestDirResourceSetMount.java b/test/org/apache/catalina/webresources/TestDirResourceSetMount.java
index 9282669cb5..fee86d67a3 100644
--- a/test/org/apache/catalina/webresources/TestDirResourceSetMount.java
+++ b/test/org/apache/catalina/webresources/TestDirResourceSetMount.java
@@ -52,7 +52,7 @@ public class TestDirResourceSetMount extends AbstractTestResourceSetMount {
     public WebResourceRoot getWebResourceRoot() {
         TesterWebResourceRoot root = new TesterWebResourceRoot();
         WebResourceSet webResourceSet =
-                new DirResourceSet(new TesterWebResourceRoot(), getMount(),
+                new DirResourceSet(new TesterWebResourceRoot(), getMount() + "/",
                         getBaseDir().getAbsolutePath(), "/");
         root.setMainResources(webResourceSet);
         return root;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 196a246503..bec9650d9f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -206,6 +206,10 @@
         Fix JMX value for <code>keepAliveCount</code> on the endpoint. Also add
         the value of <code>useVirtualThreads</code> in JMX. (remm)
       </fix>
+      <fix>
+        <bug>69717</bug>: Allow trailing slash for <code>webAppMount</code>
+        path in <code>Resources</code>, for compatibility reasons. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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


Re: (tomcat) branch main updated: Allow trailing slash for webAppMount in Resources

Posted by Rémy Maucherat <re...@apache.org>.
On Fri, Jun 20, 2025 at 3:27 PM Mark Thomas <ma...@apache.org> wrote:
>
> On 20/06/2025 13:13, remm@apache.org wrote:
> > 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 4c688213d9 Allow trailing slash for webAppMount in Resources
> > 4c688213d9 is described below
> >
> > commit 4c688213d931a1979c9f2f0c5265dd87b32dca3b
> > Author: remm <re...@apache.org>
> > AuthorDate: Fri Jun 20 14:13:30 2025 +0200
> >
> >      Allow trailing slash for webAppMount in Resources
> >
> >      BZ69717
> >      Mostly for compatibility reasons as most paths are usually without a
> >      trailing slash, if it is not meaningful.
>
> I was working on this too. I have a bunch of extra tests I'll commit
> once I sort out the merge conflicts.

Sorry. No problem if you need to refix it. I didn't add a new test
since the slash-less case is tested everywhere else, and adding a
slash there caused the test to fail.

Rémy

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


Re: (tomcat) branch main updated: Allow trailing slash for webAppMount in Resources

Posted by Mark Thomas <ma...@apache.org>.
On 20/06/2025 13:13, remm@apache.org wrote:
> 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 4c688213d9 Allow trailing slash for webAppMount in Resources
> 4c688213d9 is described below
> 
> commit 4c688213d931a1979c9f2f0c5265dd87b32dca3b
> Author: remm <re...@apache.org>
> AuthorDate: Fri Jun 20 14:13:30 2025 +0200
> 
>      Allow trailing slash for webAppMount in Resources
>      
>      BZ69717
>      Mostly for compatibility reasons as most paths are usually without a
>      trailing slash, if it is not meaningful.

I was working on this too. I have a bunch of extra tests I'll commit 
once I sort out the merge conflicts.

Mark


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