Commits

Stephen McDonald committed 29d2fca Draft

Fix paths for filebrowser fields on Windows.

Comments (0)

Files changed (1)

filebrowser_safe/views.py

         results_var['results_total'] += 1
 
         # CREATE FILEOBJECT
-        fileobject = FileObject(os.path.join(get_directory(), path, file))
+        url_path = "/".join([s.strip("/") for s in
+                            [get_directory(), path, file] if s.strip("/")])
+        fileobject = FileObject(url_path)
         # Strip leading slash in dirnames for MEDIA_LIBRARY_PER_SITE
         fileobject.path_relative_directory = fileobject.path_relative_directory.lstrip("/")