On 10/02/2015 21:08, Konstantin Kolinko wrote:
> 2015-02-10 23:54 GMT+03:00 <[email protected]>:
>> Author: markt
>> Date: Tue Feb 10 20:54:07 2015
>> New Revision: 1658804
>>
>> URL: http://svn.apache.org/r1658804
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57556
>> Align getRealPath() behaviour with that of earlier versions and include a
>> trailing separator if the real path refers to a directory.
>>
>> 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=1658804&r1=1658803&r2=1658804&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
>> (original)
>> +++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Tue Feb
>> 10 20:54:07 2015
>> @@ -4407,7 +4407,12 @@ public class StandardContext extends Con
>> }
>> if (resources != null) {
>> try {
>> - return resources.getResource(path).getCanonicalPath();
>> + WebResource resource = resources.getResource(path);
>> + if (resource.isDirectory()) {
>> + return resource.getCanonicalPath() + File.separatorChar;
>
> 1) I think it is better to check whether it ends with separatorChar first.
>
> E.g. if a Windows drive root is deployed as a web application. I think
> that getCanonicalPath() will end with a backslash.
It does. Additional tests and a fix on the way.
> T:\ is the root directory of drive T,
> T: is the current directory on drive T.
>
> 2) I think that this changes the value of getRealPath(""),
I've added this to the tests. The behaviour is consistent.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]