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 /searx/engines/__init__.py | |
parent | bee7b497a300622f5ba2b619817f5c89c29ae871 (diff) | |
download | searxng-86daef2063a83a6aee90e9f269644e0803ae9cb9.tar.gz searxng-86daef2063a83a6aee90e9f269644e0803ae9cb9.zip |
[fix] do not allow underscore in engine names - closes #708
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r-- | searx/engines/__init__.py | 12 |
1 files changed, 9 insertions, 3 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: |