mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
actions: Raise a proper exception if privileged module is not found
Without the change FileNotFound exception is raised. Tests: - Send request using 'nc' to privileged daemon that has invalid 'module' parameter. SyntaxError exception is raised. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
parent
a70611a2e9
commit
80705b85af
@ -547,7 +547,10 @@ def _privileged_call(module_name, action_name, arguments):
|
||||
if module_name == 'plinth':
|
||||
import_path = 'plinth'
|
||||
else:
|
||||
import_path = module_loader.get_module_import_path(module_name)
|
||||
try:
|
||||
import_path = module_loader.get_module_import_path(module_name)
|
||||
except FileNotFoundError as exception:
|
||||
raise SyntaxError('Specified module not found') from exception
|
||||
|
||||
try:
|
||||
module = importlib.import_module(import_path + '.privileged')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user