Skip to content

Commit 932f3e9

Browse files
ParkGyeongTaeReamer
authored andcommitted
[ZEPPELIN-6202] Fix %20 showing in notebook tree by URL-decoding note file paths
### What is this PR for? This PR fixes a UI bug where notebook and folder names that contain spaces are displayed with the URL-encoded text %20 in the notebook tree (e.g., Flink%20Tutorial). We now URL-decode the VFS path and keep the existing Windows-specific prefix handling, so names with spaces render correctly across all platforms. ### What type of PR is it? Bug Fix ### Todos * [x] - Add URL-decode logic in path normalisation ### What is the Jira issue? * Jira: https://issues.apache.org/jira/browse/ZEPPELIN/ZEPPELIN-6202 ### How should this be tested? * Build this branch and start Zeppelin. * Create or import a notebook whose name contains a space (e.g., “Python Tutorial”). ### Screenshots (if appropriate) Before ![image](https://github.com/user-attachments/assets/f1fba587-fd88-4034-b224-f2edc08e5f1d) After ![image](https://github.com/user-attachments/assets/0577c8c2-6f48-475f-b47e-30afd144bfd3) ### Questions: * Does the license files need to update? No. * Is there breaking changes for older versions? No. * Does this needs documentation? No. Closes #4947 from ParkGyeongTae/ZEPPELIN-6202. Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com> (cherry picked from commit 890ddfe) Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>
1 parent 92b7725 commit 932f3e9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.io.OutputStream;
2323
import java.net.URI;
2424
import java.net.URISyntaxException;
25+
import java.net.URLDecoder;
26+
import java.nio.charset.StandardCharsets;
2527
import java.util.ArrayList;
2628
import java.util.Collections;
2729
import java.util.HashMap;
@@ -114,9 +116,13 @@ private Map<String, NoteInfo> listFolder(FileObject fileObject) throws IOExcepti
114116
noteInfos.putAll(listFolder(child));
115117
}
116118
} else {
117-
// getPath() method returns a string without root directory in windows, so we use getURI() instead
118-
// windows does not support paths with "file:///" prepended. so we replace it by "/"
119-
String noteFileName = fileObject.getName().getURI().replace("file:///", "/");
119+
// getPath() drops the drive on Windows, so use getURI().
120+
// Decode URI to change %20 to spaces.
121+
// Windows cannot handle "file:///", replace it with "/".
122+
String noteFileName = URLDecoder.decode(
123+
fileObject.getName().getURI(), StandardCharsets.UTF_8
124+
).replace("file:///", "/");
125+
120126
if (noteFileName.endsWith(".zpln")) {
121127
try {
122128
String noteId = getNoteId(noteFileName);

0 commit comments

Comments
 (0)