Преглед изворни кода

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

Ying Chen пре 5 година
родитељ
комит
57e496ba03
1 измењених фајлова са 6 додато и 0 уклоњено
  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