Smart123s / ItchClaim

Automatically claim free games from itch.io
https://itchclaim.tmbpeter.com
MIT License
52 stars 1 forks source link

Usernames with slashes #1

Closed stabilergriller closed 1 year ago

stabilergriller commented 1 year ago

Found your post on FreeGameFindings, great idea. But I have a problem:

Itch allows all kinds of special characters in a username. This seems to be a problem for example when your username is "A/B" (I'm replacing all references to my username with 'A/B', to not doxx myself):

$ itchclaim login A/B

Enter password for user A/B:
Traceback (most recent call last):
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/__main__.py", line 139, in login
    self.user.load_session()
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/ItchUser.py", line 97, in load_session
    with open(self.get_default_session_filename(), 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/xxx/.config/itchclaim/users/session-A/B.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxx/.local/bin/itchclaim", line 8, in <module>
    sys.exit(main())
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/__main__.py", line 147, in main
    Fire(ItchClaim)
  File "/home/xxx/.local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/xxx/.local/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/xxx/.local/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/__main__.py", line 142, in login
    self.user.login(password, totp)
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/ItchUser.py", line 82, in login
    self.save_session()
  File "/home/xxx/.local/lib/python3.10/site-packages/ItchClaim/ItchUser.py", line 92, in save_session
    with open(self.get_default_session_filename(), 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/xxx/.config/itchclaim/users/session-A/B.json'
Smart123s commented 1 year ago

Forgot to reference this issue in the commit message, but should be fixed by https://github.com/Smart123s/ItchClaim/commit/668ba1e2342e89b0a871aeaf78c6cb7206525ac7.

Update the package via pip install -U itchclaim.