file-store: don't response with cookies on file-store download.
This commit is contained in:
parent
e9a4bf30eb
commit
ceaa1dd337
2 changed files with 9 additions and 2 deletions
|
|
@ -93,6 +93,9 @@ class FileStoreView(BaseAppView):
|
|||
|
||||
file_path = self.storage.store_path(file_uid)
|
||||
return FileResponse(file_path)
|
||||
# For file store we don't submit any session data, this logic tells the
|
||||
# Session lib to skip it
|
||||
setattr(self.request, '_file_response', True)
|
||||
|
||||
@LoginRequired()
|
||||
@NotAnonymous()
|
||||
|
|
|
|||
|
|
@ -32,10 +32,14 @@ def BeakerSessionFactoryConfig(**options):
|
|||
|
||||
def session_callback(request, response):
|
||||
exception = getattr(request, 'exception', None)
|
||||
if (exception is None or self._cookie_on_exception) and self.accessed():
|
||||
file_response = getattr(request, '_file_response', None)
|
||||
|
||||
if file_response is None \
|
||||
and (exception is None or self._cookie_on_exception) \
|
||||
and self.accessed():
|
||||
self.persist()
|
||||
headers = self.__dict__['_headers']
|
||||
if headers['set_cookie'] and headers['cookie_out']:
|
||||
if headers.get('set_cookie') and headers.get('cookie_out'):
|
||||
response.headerlist.append(('Set-Cookie', headers['cookie_out']))
|
||||
request.add_response_callback(session_callback)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue