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