Check for valid script extension when using a prefix override

* Also removes php, ruby, and perl overrides
This commit is contained in:
JonnyWong16 2020-07-23 17:30:34 -07:00
parent e0e5ac9ecc
commit 8f1360d7c2
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -2977,7 +2977,12 @@ class SCRIPTS(Notifier):
self.pythonpath_override = 'nopythonpath' self.pythonpath_override = 'nopythonpath'
self.pythonpath = True self.pythonpath = True
self.prefix_overrides = ('python2', 'python3', 'python', 'pythonw', 'php', 'ruby', 'perl') self.prefix_overrides = {
'python': ['.py'],
'python2': ['.py'],
'python3': ['.py'],
'pythonw': ['.py', '.pyw']
}
self.script_killed = False self.script_killed = False
def list_scripts(self): def list_scripts(self):
@ -3114,10 +3119,14 @@ class SCRIPTS(Notifier):
del script_args[0] del script_args[0]
# Allow overrides for shitty systems # Allow overrides for shitty systems
if prefix and script_args: if prefix and script_args and script_args[0] in self.prefix_overrides:
if script_args[0] in self.prefix_overrides: if ext in self.prefix_overrides[script_args[0]]:
script[0] = script_args[0] script[0] = script_args[0]
del script_args[0] del script_args[0]
else:
logger.error("Tautulli Notifiers :: Invalid prefix override '%s' for '%s' script, exiting..."
% (script_args[0], ext))
return
script.extend(script_args) script.extend(script_args)