Commits

Anonymous committed 5383678

added redirect backend and fixed a bug in xsendfile

  • Participants
  • Parent commits b3f6589

Comments (0)

Files changed (2)

filetransfers/backends/redirect.py

+from django.conf import settings
+from django.http import HttpResponseRedirect
+from django.utils.encoding import smart_str
+
+def serve_file(request, file, save_as, content_type):
+    return HttpResponseRedirect(smart_str(
+        settings.FILETRANSFERS_BASE_REDIRECT_URL + file.name))

filetransfers/backends/xsendfile.py

 from django.utils.encoding import smart_str
 
 def serve_file(request, file, save_as, content_type):
-    response = HttpResponse(ChunkedFile(file), content_type=content_type)
+    response = HttpResponse(content_type=content_type)
     response['X-Sendfile'] = file.path
     if save_as:
         response['Content-Disposition'] = smart_str(u'attachment; filename=%s' % save_as)