From 6be5397a2d5160c05874b4bc01754e401060fca4 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Mon, 13 Aug 2018 09:34:31 -0700 Subject: [PATCH] Decode script args before formatting --- plexpy/notification_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index c14e559c..0c3e0c89 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1048,7 +1048,7 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None, if agent_id == 15: try: - script_args = [custom_formatter.format(arg, **parameters).decode(plexpy.SYS_ENCODING, 'ignore') + script_args = [custom_formatter.format(arg.decode(plexpy.SYS_ENCODING, 'ignore'), **parameters) for arg in shlex.split(subject.encode(plexpy.SYS_ENCODING, 'ignore'))] except LookupError as e: logger.error(u"Tautulli NotificationHandler :: Unable to parse parameter %s in script argument. Using fallback." % e) @@ -1068,7 +1068,7 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None, if body: def str_format(s): if isinstance(s, basestring): - return custom_formatter.format(s, **parameters).decode(plexpy.SYS_ENCODING, 'ignore') + return custom_formatter.format(unicode(s), **parameters) return s try: