Browse Source

HUE-9505 [fb] Add slash back if it was removed by proxy

Ying Chen 5 năm trước cách đây
mục cha
commit
57e496ba03
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      apps/filebrowser/src/filebrowser/views.py

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

@@ -142,6 +142,12 @@ def download(request, path):
     This is inspired by django.views.static.serve.
     ?disposition={attachment, inline}
     """
+    # check if protocol missing / and add it back
+    if path.startswith('abfs:/') and not path.startswith('abfs://'):
+      path = path.replace('abfs:/', 'abfs://')
+    if path.startswith('s3a:/') and not path.startswith('s3a://'):
+      path = path.replace('s3a:/', 's3a://')
+
     decoded_path = urllib_unquote(path)
     if path != decoded_path:
       path = decoded_path