Minor decorator fix.

This commit is contained in:
voussoir 2023-06-25 21:13:52 -07:00
parent 3c505e1244
commit e1c47e8bf6
2 changed files with 9 additions and 2 deletions

View file

@ -99,8 +99,11 @@ def before_request():
if site.localhost_only and not request.is_localhost:
return flask.abort(403)
# Since we don't define this route, I can't just add this where it belongs.
# Sorry.
if request.url_rule is None:
return flask.abort(404)
# Since we don't define this route (/static/ is a default from flask),
# I can't just add this where it belongs. Sorry.
if request.url_rule.rule == '/static/<path:filename>':
permission_manager.global_public()

View file

@ -63,6 +63,10 @@ class SessionManager:
# Send the token back to the client
# but only if the endpoint didn't manually set the cookie.
function_cookies = response.headers.get_all('Set-Cookie')
if not hasattr(request, 'session') or not request.session:
return response
if not any('etiquette_session=' in cookie for cookie in function_cookies):
response.set_cookie(
'etiquette_session',