Skip to content

Commit

Permalink
Maybe?
Browse files Browse the repository at this point in the history
  • Loading branch information
Szaki committed Aug 21, 2024
1 parent 5cc0f36 commit 5a7b2ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions binder/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2699,15 +2699,14 @@ def dispatch_file_field(self, request, pk=None, file_field=None):
try:
if serve_directly:
resp = HttpResponse(content_type=content_type)
resp['X-Accel-Redirect'] = '/internal/media/' + file_field.name
else:
resp = StreamingHttpResponse(file_field.open(), content_type=content_type)
except FileNotFoundError:
logger.error('Expected file {} not found'.format(file_field.name))
raise BinderNotFound(file_field_name)

if 'download' in request.GET:
if serve_directly:
resp['X-Accel-Redirect'] = '/internal/media/' + file_field.name
filename = self.filefield_get_name(instance=obj, request=request, file_field=file_field)
if 'prefix' in request.GET:
filename = request.GET['prefix'] + ' - ' + filename
Expand Down

0 comments on commit 5a7b2ad

Please sign in to comment.