Skip to content

Commit

Permalink
page_trail: add type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
UlrichB22 committed Nov 19, 2024
1 parent 55a3811 commit 10738f7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/moin/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ------------------------------------------------------------------
Expand Down

0 comments on commit 10738f7

Please sign in to comment.