diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java index 70175f5538e..32e433fff8f 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java @@ -22,6 +22,8 @@ import java.io.OutputStream; import java.net.URI; import java.net.URISyntaxException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -114,9 +116,13 @@ private Map listFolder(FileObject fileObject) throws IOExcepti noteInfos.putAll(listFolder(child)); } } else { - // getPath() method returns a string without root directory in windows, so we use getURI() instead - // windows does not support paths with "file:///" prepended. so we replace it by "/" - String noteFileName = fileObject.getName().getURI().replace("file:///", "/"); + // getPath() drops the drive on Windows, so use getURI(). + // Decode URI to change %20 to spaces. + // Windows cannot handle "file:///", replace it with "/". + String noteFileName = URLDecoder.decode( + fileObject.getName().getURI(), StandardCharsets.UTF_8 + ).replace("file:///", "/"); + if (noteFileName.endsWith(".zpln")) { try { String noteId = getNoteId(noteFileName);