Browse Source

HUE-8273 [filebrowser] Don't display encoded paths

jdesjean 7 years ago
parent
commit
210d4c6bf8

+ 4 - 3
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -790,6 +790,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
     }
     }
 
 
     var updateHash = function (hash) {
     var updateHash = function (hash) {
+      hash = encodeURI(hash);
       %if not is_embeddable:
       %if not is_embeddable:
       window.location.hash = hash;
       window.location.hash = hash;
       %else:
       %else:
@@ -1339,11 +1340,11 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
       };
       };
 
 
       self.editFile = function () {
       self.editFile = function () {
-        window.location.href = "${url('filebrowser.views.edit', path='')}" + self.selectedFile().path;
+        window.location.href = "${url('filebrowser.views.edit', path='')}" + encodeURI(self.selectedFile().path);
       };
       };
 
 
       self.downloadFile = function () {
       self.downloadFile = function () {
-        window.location.href = "${url('filebrowser.views.download', path='')}" + self.selectedFile().path;
+        window.location.href = "${url('filebrowser.views.download', path='')}" + encodeURI(self.selectedFile().path);
       };
       };
 
 
       self.renameFile = function () {
       self.renameFile = function () {
@@ -1351,7 +1352,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 
 
         $("#renameFileName").text(self.selectedFile().path);
         $("#renameFileName").text(self.selectedFile().path);
 
 
-        $("#newNameInput").val(encodeURI(self.selectedFile().name));
+        $("#newNameInput").val(self.selectedFile().name);
 
 
         $("#renameForm").attr("action", "/filebrowser/rename?next=${url('filebrowser.views.view', path='')}" + self.currentPath());
         $("#renameForm").attr("action", "/filebrowser/rename?next=${url('filebrowser.views.view', path='')}" + self.currentPath());
 
 

+ 4 - 4
apps/filebrowser/src/filebrowser/views.py

@@ -358,7 +358,7 @@ def listdir(request, path):
     breadcrumbs = parse_breadcrumbs(path)
     breadcrumbs = parse_breadcrumbs(path)
 
 
     data = {
     data = {
-        'path': urllib.quote(path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
+        'path': path,
         'file_filter': file_filter,
         'file_filter': file_filter,
         'breadcrumbs': breadcrumbs,
         'breadcrumbs': breadcrumbs,
         'current_dir_path': urllib.quote(path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
         'current_dir_path': urllib.quote(path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
@@ -490,7 +490,7 @@ def listdir_paged(request, path):
 
 
     is_fs_superuser = _is_hdfs_superuser(request)
     is_fs_superuser = _is_hdfs_superuser(request)
     data = {
     data = {
-        'path': urllib.quote(path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
+        'path': path,
         'breadcrumbs': breadcrumbs,
         'breadcrumbs': breadcrumbs,
         'current_request_path': urllib.quote(request.path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
         'current_request_path': urllib.quote(request.path.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
         'is_trash_enabled': is_trash_enabled,
         'is_trash_enabled': is_trash_enabled,
@@ -535,7 +535,7 @@ def _massage_stats(request, stats):
     path = stats['path']
     path = stats['path']
     normalized = request.fs.normpath(path)
     normalized = request.fs.normpath(path)
     return {
     return {
-        'path': urllib.quote(normalized.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
+        'path': normalized,
         'name': stats['name'],
         'name': stats['name'],
         'stats': stats.to_json_dict(),
         'stats': stats.to_json_dict(),
         'mtime': datetime.fromtimestamp(stats['mtime']).strftime('%B %d, %Y %I:%M %p') if stats['mtime'] else '',
         'mtime': datetime.fromtimestamp(stats['mtime']).strftime('%B %d, %Y %I:%M %p') if stats['mtime'] else '',
@@ -1307,7 +1307,7 @@ def _upload_file(request):
             raise PopupException(msg)
             raise PopupException(msg)
 
 
         response.update({
         response.update({
-          'path': urllib.quote(filepath.encode('utf-8'), safe='~@#$&()*!+=:;,.?/\''),
+          'path': filepath,
           'result': _massage_stats(request, stat_absolute_path(filepath, request.fs.stats(filepath))),
           'result': _massage_stats(request, stat_absolute_path(filepath, request.fs.stats(filepath))),
           'next': request.GET.get("next")
           'next': request.GET.get("next")
         })
         })

+ 0 - 1
desktop/core/src/desktop/static/desktop/js/assist/assistStorageEntry.js

@@ -63,7 +63,6 @@ var AssistStorageEntry = (function () {
       }
       }
     }
     }
     self.path += self.definition.name;
     self.path += self.definition.name;
-    self.path = encodeURI(self.path);
     self.currentPage = 1;
     self.currentPage = 1;
     self.hasMorePages = true;
     self.hasMorePages = true;
     self.preview = ko.observable();
     self.preview = ko.observable();