Skip to content

Commit

Permalink
Disable browser caching for guest files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kitsuta committed Jan 7, 2025
1 parent 89dea68 commit 10bbe18
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uber/site_sections/guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 10bbe18

Please sign in to comment.