From 86daef2063a83a6aee90e9f269644e0803ae9cb9 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 28 Sep 2016 22:30:05 +0200 Subject: [PATCH] [fix] do not allow underscore in engine names - closes #708 --- searx/engines/__init__.py | 12 +++++++++--- searx/settings.yml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 782b622b0..14376c31f 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -57,11 +57,17 @@ def load_module(filename): def load_engine(engine_data): - engine_name = engine_data['engine'] + + if '_' in engine_data['name']: + logger.error('Engine name conains underscore: "{}"'.format(engine_data['name'])) + sys.exit(1) + + engine_module = engine_data['engine'] + try: - engine = load_module(engine_name + '.py') + engine = load_module(engine_module + '.py') except: - logger.exception('Cannot load engine "{}"'.format(engine_name)) + logger.exception('Cannot load engine "{}"'.format(engine_module)) return None for param_name in engine_data: diff --git a/searx/settings.yml b/searx/settings.yml index 308a0bd45..72bc7ed0f 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -377,7 +377,7 @@ engines: timeout : 10.0 disabled : True - - name : scanr_structures + - name : scanr structures shortcut: scs engine : scanr_structures disabled : True