Skip to content

Commit

Permalink
Add content disposition header
Browse files Browse the repository at this point in the history
  • Loading branch information
derneuere committed May 20, 2024
1 parent e7f920a commit a6d783d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,9 @@ def get(self, request, path, fname, format=None):
mime = magic.Magic(mime=True)
filename = mime.from_file(photo.main_file.path)
response["Content-Type"] = filename
response["Content-Disposition"] = 'inline; filename="{}"'.format(
photo.main_file.path.split("/")[-1]
)
response["X-Accel-Redirect"] = internal_path
else:
try:
Expand Down

0 comments on commit a6d783d

Please sign in to comment.