Browse Source

Fix Content-Disposition to inline so PDFs open in browser instead of downloading

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rate-limiter-2026
Edward Ribeiro 1 week ago
parent
commit
6224989521
  1. 2
      sapl/base/media.py

2
sapl/base/media.py

@ -78,7 +78,7 @@ def serve_media(request, path):
content_type, _ = mimetypes.guess_type(filename)
response = HttpResponse(content_type=content_type or 'application/octet-stream')
response['X-Accel-Redirect'] = f'/internal/media/{path}'
response['Content-Disposition'] = f"attachment; filename*=UTF-8''{quote(filename)}"
response['Content-Disposition'] = f"inline; filename*=UTF-8''{quote(filename)}"
response['Cache-Control'] = 'public, max-age=86400, stale-while-revalidate=3600'
response['X-Robots-Tag'] = 'noindex'
return response

Loading…
Cancel
Save