diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-09-28 22:30:05 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-09-28 22:30:05 +0200 |
commit | 86daef2063a83a6aee90e9f269644e0803ae9cb9 (patch) | |
tree | 07070d4205086ee7e499dddce4ab6ad26c818391 | |
parent | bee7b497a300622f5ba2b619817f5c89c29ae871 (diff) | |
download | searxng-86daef2063a83a6aee90e9f269644e0803ae9cb9.tar.gz searxng-86daef2063a83a6aee90e9f269644e0803ae9cb9.zip |
[fix] do not allow underscore in engine names - closes #708
-rw-r--r-- | searx/engines/__init__.py | 12 | ||||
-rw-r--r-- | 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 |