From 966644baa055bad8b03cb13710313a4aeb8eba22 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Thu, 16 Jun 2022 15:46:18 -0600 Subject: [PATCH] Broaden session validation exception handling Due to how instances installed with pip seem to have issues storing unrelated files in the same directory as sessions, exception handling during session validation has been expanded to blindly ignore all exceptions. This portion of the code is more for maintainers of large public instances with a bunch of users who block cookies anyways, so having basic app functionality break down as a result shouldn't be the default. --- app/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index d236682..d54aaf2 100644 --- a/app/routes.py +++ b/app/routes.py @@ -85,7 +85,10 @@ def session_required(f): if isinstance(data, dict) and 'valid' in data: continue invalid_sessions.append(file_path) - except (EOFError, FileNotFoundError, pickle.UnpicklingError): + except Exception: + # Broad exception handling here due to how instances installed + # with pip seem to have issues storing unrelated files in the + # same directory as sessions pass for invalid_session in invalid_sessions: