Ejemplo n.º 1
0
 @Test(expected = PathTraversalException.class)
 public void dotDotShouldBeDisallowedIfOutsideSecureDir() throws Exception {
   PathUtils.ensurePathInSecureDir(tmpDir, new File(tmpDir, "../").getPath()); // ${tmpDir}/..
 }
Ejemplo n.º 2
0
 @Test
 public void dotDotShouldBeAllowedIfInsideSecureDir() throws Exception {
   PathUtils.ensurePathInSecureDir(
       tmpDir, new File(tmpDir, "a/b/../b").getAbsolutePath()); // ${tmpDir}/a/b
 }