Skip to content

Commit

Permalink
Merge pull request #1806 from UlrichB22/fix_1801
Browse files Browse the repository at this point in the history
page_trail: add type checks
  • Loading branch information
RogerHaase authored Nov 20, 2024
2 parents 55a3811 + 10738f7 commit b4ba765
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 b4ba765

Please sign in to comment.