Author: markt
Date: Tue Apr 28 21:03:04 2015
New Revision: 1676630
URL: http://svn.apache.org/r1676630
Log:
Further fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=57556
Only include a trailing separator in the real path if the requested path
included one.
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1676630&r1=1676629&r2=1676630&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Tue Apr 28
21:03:04 2015
@@ -4411,7 +4411,8 @@ public class StandardContext extends Con
String canonicalPath = resource.getCanonicalPath();
if (canonicalPath == null) {
return null;
- } else if (resource.isDirectory() &&
!canonicalPath.endsWith(File.separator)) {
+ } else if ((resource.isDirectory() &&
!canonicalPath.endsWith(File.separator) ||
+ !resource.exists()) && path.endsWith("/")) {
return canonicalPath + File.separatorChar;
} else {
return canonicalPath;
Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1676630&r1=1676629&r2=1676630&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Tue Apr
28 21:03:04 2015
@@ -956,11 +956,11 @@ public class TestStandardContext extends
doTestBug57556(testContext, "", base + File.separatorChar);
doTestBug57556(testContext, "/", base + File.separatorChar);
- doTestBug57556(testContext, "/jsp", base + File.separatorChar+ "jsp" +
File.separatorChar);
+ doTestBug57556(testContext, "/jsp", base + File.separatorChar+ "jsp");
doTestBug57556(testContext, "/jsp/", base + File.separatorChar+ "jsp"
+ File.separatorChar);
doTestBug57556(testContext, "/index.html", base + File.separatorChar +
"index.html");
- // Doesn't exist so Tomcat will assume it is a file, not a directory.
doTestBug57556(testContext, "/foo", base + File.separatorChar + "foo");
+ doTestBug57556(testContext, "/foo/", base + File.separatorChar + "foo"
+ File.separatorChar);
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]