diff --git a/common/src/main/java/apoc/log/Neo4jLogStream.java b/common/src/main/java/apoc/log/Neo4jLogStream.java index bb7fb0c851..c0932f9e39 100644 --- a/common/src/main/java/apoc/log/Neo4jLogStream.java +++ b/common/src/main/java/apoc/log/Neo4jLogStream.java @@ -56,8 +56,7 @@ public Stream stream( File f = new File(logDir, logName); try { - String canonicalPath = f.getCanonicalPath(); - if (!canonicalPath.startsWith(logDir.getAbsolutePath())) { + if (!f.getCanonicalFile().toPath().startsWith(logDir.getAbsolutePath())) { throw new RuntimeException("The path you are trying to access has a canonical path outside of the logs " + "directory, and this procedure is only permitted to access files in the log directory. This may " + "occur if the path in question is a symlink or other link.");