From 10bbe18d2f73a138f0ea77832672f99618abc973 Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Tue, 7 Jan 2025 16:43:32 -0500 Subject: [PATCH] Disable browser caching for guest files Guests were getting confused because they'd upload a new bio pic but when they downloaded it, they'd get the old one. It seems like this was an issue on the browser side, so we now instruct browsers to not cache the page handlers that serve these files. --- uber/site_sections/guests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/uber/site_sections/guests.py b/uber/site_sections/guests.py index f564d5d78..ee02f31ee 100644 --- a/uber/site_sections/guests.py +++ b/uber/site_sections/guests.py @@ -605,12 +605,14 @@ def view_inventory_file(self, session, id, item_id, name): cherrypy.response.headers['Accept-Ranges'] = 'bytes' cherrypy.response.headers['Content-Length'] = filesize cherrypy.response.headers['Content-Range'] = 'bytes 0-{}'.format(filesize) + cherrypy.response.headers['Cache-Control'] = 'no-store' return serve_file(filepath, disposition='inline', name=download_filename, content_type=content_type) else: raise cherrypy.HTTPError(404, "File not found") def view_bio_pic(self, session, id): guest = session.guest_group(id) + cherrypy.response.headers['Cache-Control'] = 'no-store' return serve_file( guest.bio.pic_fpath, disposition="attachment", @@ -619,6 +621,7 @@ def view_bio_pic(self, session, id): def view_stage_plot(self, session, id): guest = session.guest_group(id) + cherrypy.response.headers['Cache-Control'] = 'no-store' return serve_file( guest.stage_plot.fpath, disposition="attachment",