Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4948f0ee authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Fix build.

Bad automatic merge by git resulted in a dup. of a function.

Change-Id: Idb8fd8a48e1a9f6aeac98a199d6b8c661efaab16
parent 64424940
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -382,26 +382,4 @@ public class FileUtils {
        }
        return filePath.startsWith(dirPath);
    }

    /**
     * Test if a file lives under the given directory, either as a direct child
     * or a distant grandchild.
     * <p>
     * Both files <em>must</em> have been resolved using
     * {@link File#getCanonicalFile()} to avoid symlink or path traversal
     * attacks.
     */
    public static boolean contains(File dir, File file) {
        String dirPath = dir.getAbsolutePath();
        String filePath = file.getAbsolutePath();

        if (dirPath.equals(filePath)) {
            return true;
        }

        if (!dirPath.endsWith("/")) {
            dirPath += "/";
        }
        return filePath.startsWith(dirPath);
    }
}