Skip to content
Snippets Groups Projects
Commit 5879d2d6 authored by R En's avatar R En
Browse files

Update views.py to modify headers depending on Nginx or Apache

parent 43e7555b
Branches
Tags 0.20.1
No related merge requests found
......@@ -238,6 +238,9 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet):
f.serve_from_source_path)
response = Response()
filename = f.filename
if settings.USE_APACHE_HEADERS:
response['X-Sendfile'] = file_path
else:
response['X-Accel-Redirect'] = file_path
filename = "filename*=UTF-8''{}".format(
urllib.parse.quote(filename))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment