Explorar o código

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 %!s(int64=9) %!d(string=hai) anos
pai
achega
8ee9f9c
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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)