Skip to content

Fix History Page Crash (Issue #1886) #1902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cece-cuevas
Copy link

Fix the history page crash for malformed user profiles and add a test

  • Wrapped user.User(userid) logic in get_editor_info with a try-except block to prevent crashes when encountering broken or malformed user profile metadata.
  • Added fallback values ("anonymous", "Unknown", etc.) to ensure graceful degradation in the UI.
  • Created a new unit test test_get_editor_info.py to verify behavior with both valid and invalid metadata.

Fixes #1886

css = "editor homepage interwiki"
uri = url_for_item(name, wiki_name=homewiki, _external=external, namespace=NAMESPACE_USERS)
except Exception:
# Fall back to default values if user profile loading fails
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please log the exception. This should not get unnoticed.
Also think about catching a more specific exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

History page crashes on extracting editor's name/email address
2 participants