Skip to content
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

Handle missing account icon & full name #1241

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

Conversation

wjt
Copy link
Member

@wjt wjt commented Nov 10, 2021

When trying to use Clubhouse in a WSL2 container, I hit a few problems because my user account had no RealName (or IconFile) configured in Accounts Service. So here are three fixes:

  • clubhouse: Don't prepend to empty IconFile path
  • clubhouse: Discard all whitespace from RealName
  • clubhouse: Handle empty RealName

wjt added 3 commits November 10, 2021 12:02
If this property is empty, we don't want to prepend /var/run/host to it,
since that will defeat the 'if icon_file' check just a few lines later.
str.split() has a special case when the separator is not provided, which
is actually more desirable. It is best demonstrated by example:

    >>> "Will   Thompson ".split(" ")
    ['Will', '', '', 'Thompson', '']
    >>> "Will   Thompson ".split()
    ['Will', 'Thompson']
    >>> "".split(" ")
    ['']
    >>> "".split()
    []

This change ensures that all elements of 'tokens' are non-empty.
If a user account's RealName property is empty, we would previously
crash while trying to pick the initials out of it:

    Traceback (most recent call last):
      File "/app/lib/python3.9/site-packages/eosclubhouse/clubhouse.py", line 3210, in do_activate
      File "/app/lib/python3.9/site-packages/eosclubhouse/clubhouse.py", line 3374, in _ensure_window
      File "/app/lib/python3.9/site-packages/eosclubhouse/clubhouse.py", line 2296, in __init__
      File "/app/lib/python3.9/site-packages/eosclubhouse/clubhouse.py", line 2438, in update_user_info
    IndexError: list index out of range

We would also set the empty string as the label for the user.

Fall back to the UserName, which is guaranteed to be non-empty, if
RealName is empty or all-whitespace.

(I encountered this problem in a WSL2 container, but the same problem
can be reproduced on any system.)
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.

1 participant