From 5293ae03118af75b55cbd33159ea3d8d84d680da Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Wed, 18 Mar 2015 11:08:08 -0700 Subject: [PATCH] HDFS-7953. NN Web UI fails to navigate to paths that contain #. Contributed by kanaka kumar avvaru. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop-hdfs/src/main/webapps/hdfs/explorer.js | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5c486b0416e..6cdc21b6226 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -852,6 +852,9 @@ Release 2.7.0 - UNRELEASED HDFS-7946. TestDataNodeVolumeFailureReporting NPE on Windows. (Xiaoyu Yao via Arpit Agarwal) + HDFS-7953. NN Web UI fails to navigate to paths that contain #. + (kanaka kumar avvaru via wheat9) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js index 0a53dcd65a8..131b2aa64f2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js @@ -78,6 +78,12 @@ return data.RemoteException !== undefined ? data.RemoteException.message : ""; } + function encode_path(abs_path) { + abs_path = encodeURIComponent(abs_path); + var re = /%2F/g; + return abs_path.replace(re, '/'); + } + function view_file_details(path, abs_path) { function show_block_info(blocks) { var menus = $('#file-info-blockinfo-list'); @@ -102,12 +108,6 @@ menus.change(); } - function encode_path(abs_path) { - abs_path = encodeURIComponent(abs_path); - var re = /%2F/g; - return abs_path.replace(re, '/'); - } - abs_path = encode_path(abs_path); var url = '/webhdfs/v1' + abs_path + '?op=GET_BLOCK_LOCATIONS'; $.get(url).done(function(data) { @@ -149,7 +149,7 @@ return chunk.write('' + new Date(Number(value)).toLocaleString()); } }; - var url = '/webhdfs/v1' + dir + '?op=LISTSTATUS'; + var url = '/webhdfs/v1' + encode_path(dir) + '?op=LISTSTATUS'; $.get(url, function(data) { var d = get_response(data, "FileStatuses"); if (d === null) {