[PY3] Fix tray password encoding issue

The tray password need to be in bytes but GTK on Py3 returns unicode.

Use decode_bytes and then encode to ensure Py2/3 compatibility.
This commit is contained in:
Calum Lind 2018-10-18 16:27:00 +01:00
parent 1d0e40c66b
commit 0b39b529dd

View File

@ -19,7 +19,7 @@ from twisted.internet import reactor
from twisted.internet.error import ReactorNotRunning
import deluge.component as component
from deluge.common import fspeed, resource_filename
from deluge.common import decode_bytes, fspeed, resource_filename
from deluge.configmanager import ConfigManager
from deluge.ui.client import client
@ -179,7 +179,7 @@ class MainWindow(component.Component):
if response_id == Gtk.ResponseType.OK:
if (
self.config['tray_password']
== sha(dialog.get_password()).hexdigest()
== sha(decode_bytes(dialog.get_password()).encode()).hexdigest()
):
restore()