settings.json isn't properly initialized when changing active account
Closed this issue · 0 comments
ayleph commented
Setting an account with a shorter webfinger active leaves remnants of the previous account's webfinger in settings.json. To wit:
$ python p activate ayleph@goblin.thisshitistemp.com
$ cat ~/.config/p/settings.json
{"active": "ayleph@goblin.thisshitistemp.com", "verify_ssl_certs": true}
$ python p activate ayleph@test.thisshitistemp.com
$ cat ~/.config/p/settings.json
{"active": "ayleph@test.thisshitistemp.com", "verify_ssl_certs": true}e}
This causes problems, such as:
$ python p accounts
Traceback (most recent call last):
File "p", line 883, in <module>
settings = Settings.load(None, None)
File "/home/ayleph/p/src/pypump/pypump/store.py", line 177, in load
data = json.loads(data)
File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 71 - line 1 column 73 (char 70 - 72)
But this is easily fixed by removing the extraneous characters from the settings.json file.
$ truncate -s-2 ~/.config/p/settings.json
$ cat ~/.config/p/settings.json
{"active": "ayleph@test.thisshitistemp.com", "verify_ssl_certs": true}
$ python p accounts
Authorized Webfinger
✓ ayleph@test.thisshitistemp.com (active)
✓ ayleph@goblin.thisshitistemp.com