remm 00/11/17 12:09:21 Modified: catalina/src/share/org/apache/catalina/resources FileResources.java Log: - Case sensitivity is now enforced. However, it creates some problems under Windows : Let's say a foo resource exists. Foo doesn't exist (well, at least, that's what the Resources will tell you). If you set the content of Foo, you'll delete foo in the process. I can't find any workaround to this. Revision Changes Path 1.5 +33 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java Index: FileResources.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FileResources.java 2000/10/21 14:40:27 1.4 +++ FileResources.java 2000/11/17 20:09:21 1.5 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v 1.4 2000/10/21 14:40:27 craigmcc Exp $ - * $Revision: 1.4 $ - * $Date: 2000/10/21 14:40:27 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v 1.5 2000/11/17 20:09:21 remm Exp $ + * $Revision: 1.5 $ + * $Date: 2000/11/17 20:09:21 $ * * ==================================================================== * @@ -95,7 +95,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.4 $ $Date: 2000/10/21 14:40:27 $ + * @version $Revision: 1.5 $ $Date: 2000/11/17 20:09:21 $ */ public final class FileResources extends ResourcesBase { @@ -368,6 +368,20 @@ } File file = new File(base, normalized.substring(1)); + + String absPath = normalize(file.getAbsolutePath()); + String canPath = null; + try { + canPath = file.getCanonicalPath(); + if (canPath != null) + canPath = normalize(canPath); + } catch (IOException e) { + } + if ((canPath == null) || (absPath == null) + || (!canPath.equals(absPath))) + return (false); + + //File file = file(normalized.substring(1)); if (file != null) { // if (debug >= 1) // log("exists(" + path + ") --> " + file.exists() + @@ -694,10 +708,22 @@ if (name == null) return (null); File file = new File(base, name.substring(1)); - if (file.exists() && file.canRead()) - return (file); - else + if (file.exists() && file.canRead()) { + String absPath = normalize(file.getAbsolutePath()); + String canPath = null; + try { + canPath = file.getCanonicalPath(); + if (canPath != null) + canPath = normalize(canPath); + } catch (IOException e) { + } + if ((canPath == null) || (absPath == null) + || (!canPath.equals(absPath))) + return (null); + return (file); + } else { return (null); + } }