You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/11/09 02:35:58 UTC

svn commit: r712461 - /tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java

Author: markt
Date: Sat Nov  8 17:35:58 2008
New Revision: 712461

URL: http://svn.apache.org/viewvc?rev=712461&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42673
Correctly handle includes with multi-level contexts
Patch provided by Peter Jodeleit

Modified:
    tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java

Modified: tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java?rev=712461&r1=712460&r2=712461&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java Sat Nov  8 17:35:58 2008
@@ -353,14 +353,12 @@
     }
 
 
-    protected String getPathWithoutContext(String servletPath) {
-        String retVal = null;
-        int secondSlash = servletPath.indexOf('/', 1);
-        if (secondSlash >= 0) {
-            //cut off context
-            retVal = servletPath.substring(secondSlash);
+    protected String getPathWithoutContext(final String contextPath,
+            final String servletPath) {
+        if (servletPath.startsWith(contextPath)) {
+            return servletPath.substring(contextPath.length());
         }
-        return retVal;
+        return servletPath;
     }
 
 
@@ -419,7 +417,8 @@
                 // ie:
                 // '/file1.shtml' vs '/appName1/file1.shtml'
                 if (!isRootContext(normContext)) {
-                    String noContext = getPathWithoutContext(normalized);
+                    String noContext = getPathWithoutContext(
+                            normContext.getContextPath(), normalized);
                     if (noContext == null) {
                         throw new IOException(
                                 "Couldn't remove context from path: "



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