Skip to content

Commit

Permalink
Merge pull request #6611 from kozlovsky/fix/api_key_settings_encodung
Browse files Browse the repository at this point in the history
Decode api_key if gui_settings returns it as bytes
  • Loading branch information
kozlovsky authored Dec 2, 2021
2 parents 0fb32a0 + bb36078 commit 151e7ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tribler-gui/tribler_gui/tribler_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def __init__(
self.gui_settings = settings
api_port = api_port or int(get_gui_setting(self.gui_settings, "api_port", DEFAULT_API_PORT))
api_key = api_key or get_gui_setting(self.gui_settings, "api_key", hexlify(os.urandom(16)))
if isinstance(api_key, bytes):
# in QSettings, api_key can be stored as bytes, then we decode it to str
api_key = api_key.decode('ascii')
self.gui_settings.setValue("api_key", api_key)

api_port = NetworkUtils().get_first_free_port(start=api_port)
Expand Down

0 comments on commit 151e7ab

Please sign in to comment.