Переглянути джерело

HUE-4345 [aws] Fix Actions when viewing an S3 file in filebrowser

Enables display actions on a file including View as binary, View file location and Download
Jenny Kim 9 роки тому
батько
коміт
8ee9f9c
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      apps/filebrowser/src/filebrowser/views.py

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

@@ -25,6 +25,7 @@ import posixpath
 import re
 import shutil
 import stat as stat_module
+import urllib2
 
 from datetime import datetime
 
@@ -163,6 +164,9 @@ def view(request, path):
             return format_preserving_redirect(request, reverse(view, kwargs=dict(path=request.fs.trash_path)))
 
     try:
+        decoded_path = urllib2.unquote(path).decode('utf8')
+        if path != decoded_path:
+          path = decoded_path
         stats = request.fs.stats(path)
         if stats.isDir:
             return listdir_paged(request, path)