Skip to content

Commit

Permalink
Prevent Caching of Preview Image
Browse files Browse the repository at this point in the history
This patch prevents the preview image from being cached in Chrome and
potentially other browsers by sending a no-cache HTTP header.
  • Loading branch information
lkiesow authored and shaardie committed May 29, 2020
1 parent 8ad15aa commit e991972
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyca/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def serve_image(image_id):
filepath = os.path.abspath(filepath)
if os.path.isfile(filepath):
directory, filename = filepath.rsplit('/', 1)
return send_from_directory(directory, filename)
response = send_from_directory(directory, filename)
response.cache_control.no_cache = True
return response
except (IndexError, KeyError):
pass
return '', 404

0 comments on commit e991972

Please sign in to comment.