diff --git a/src/main/java/io/vertx/core/file/impl/FileCache.java b/src/main/java/io/vertx/core/file/impl/FileCache.java index 377c0e9ebcc..6500ab8c6a6 100644 --- a/src/main/java/io/vertx/core/file/impl/FileCache.java +++ b/src/main/java/io/vertx/core/file/impl/FileCache.java @@ -216,7 +216,7 @@ void cacheDir(String fileName) throws IOException { private void fileNameCheck(File file) throws IOException { String fileName = file.getCanonicalPath(); String cachePath = getCacheDir().getPath(); - if (fileName.startsWith(cachePath)) { + if (file.getCanonicalFile().toPath().startsWith(cachePath)) { int cachePathLen = cachePath.length(); if (fileName.length() == cachePathLen) { return;