diff --git a/core/src/main/java/apoc/util/FileUtils.java b/core/src/main/java/apoc/util/FileUtils.java index cfab03cde3..07fc4181e2 100644 --- a/core/src/main/java/apoc/util/FileUtils.java +++ b/core/src/main/java/apoc/util/FileUtils.java @@ -6,6 +6,7 @@ import apoc.util.hdfs.HDFSUtils; import apoc.util.s3.S3URLConnection; import apoc.util.s3.S3UploadUtils; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.neo4j.configuration.GraphDatabaseSettings; @@ -193,7 +194,7 @@ private static Path resolvePath(String url) throws IOException { } private static Path relativizeIfSamePrefix(Path urlPath, Path basePath) { - if (urlPath.isAbsolute() && !urlPath.startsWith(basePath.toAbsolutePath())) { + if (FilenameUtils.getPrefixLength(urlPath.toString()) > 0 && !urlPath.startsWith(basePath.toAbsolutePath())) { // if the import folder is configured to be used as root folder we consider // it as root directory in order to reproduce the same LOAD CSV behaviour urlPath = urlPath.getRoot().relativize(urlPath);