From 10738f70113c327f70882ff43f249142124165b0 Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:16:35 +0100 Subject: [PATCH] page_trail: add type checks --- src/moin/user.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/moin/user.py b/src/moin/user.py index f146b4f4d..a59f5da4d 100644 --- a/src/moin/user.py +++ b/src/moin/user.py @@ -762,8 +762,19 @@ def get_trail(self): trail_session = session.get("trail", []) trail = [] for entry in trail_session: - aliases = [CompositeName(*alias) for alias in entry[1]] - trail.append((entry[0], aliases)) + if isinstance(entry, tuple) and len(entry) == 2: + item_name = entry[0] + try: + aliases = [CompositeName(*alias) for alias in entry[1]] + except TypeError: + aliases = [] + elif isinstance(entry, str): # old style + item_name = entry + aliases = [] + else: + logging.warning(f"Invalid page trail entry, type is {type(entry)}.") + continue + trail.append((item_name, aliases)) return trail # Other ------------------------------------------------------------------