Github user parthchandra commented on a diff in the pull request: https://github.com/apache/drill/pull/1050#discussion_r152862722 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java --- @@ -359,15 +363,30 @@ private static Path handleWildCard(final String root) { } } - private static String removeLeadingSlash(String path) { - if (path.charAt(0) == '/') { + public static String removeLeadingSlash(String path) { + if (!path.isEmpty() && path.charAt(0) == '/') { String newPath = path.substring(1); return removeLeadingSlash(newPath); } else { return path; } } + // Check if the path is a valid sub path under the parent after removing backpaths. Throw an exception if + // it is not + // We pass subpath in as a parameter only for the error message + public static boolean checkBackPaths(String parent, String combinedPath, String subpath) { + Preconditions.checkArgument(!parent.isEmpty()); + Preconditions.checkArgument(!combinedPath.isEmpty()); --- End diff -- Done
---