Skip to content

Commit

Permalink
fix password not being saved when config file created on old version
Browse files Browse the repository at this point in the history
If the 'password' field wasn't in the meta.json, we wouldn't try to save
the contents of the password field, since we were iterating over each
key in the current schema and matching it up with the appropriate field.
To fix this, just add it with a blank value if it doesn't already exist
before trying to do the save routine.

Fixes #61.
  • Loading branch information
sobjornstad committed Aug 20, 2022
1 parent d2a2904 commit ef95430
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions anki-plugin/src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def _save_wiki_values(self) -> None:
"""
current_wiki = self.wikis[self.current_wiki_index]
current_wiki[0] = self.form.wikiName.text()

# added to schema in 1.3.0, upgrade if necessary
if 'password' not in current_wiki[1].keys():
current_wiki[1]['password'] = ''

for name in list(current_wiki[1].keys()):
if getattr(self.form, name + '_', None):
control = getattr(self.form, name + '_')
Expand Down

0 comments on commit ef95430

Please sign in to comment.