diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2014-10-19 21:48:53 +0200 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2014-10-19 21:48:53 +0200 |
| commit | 5656fc472c570c44bd2d971ab7862ac01ed6cf36 (patch) | |
| tree | ca1fd8c40567a034743e4e0e18e5310cd4f6cf7b /searx/https_rewrite.py | |
| parent | 7be97597038078dc749b60ae8770af7abe1b8261 (diff) | |
| parent | 6ecf03c736bf4846d5fab08649177eb55e2e1ce0 (diff) | |
Merge pull request #117 from pointhi/https_fix
print error if https rewrite directory is not found, #116
Diffstat (limited to 'searx/https_rewrite.py')
| -rw-r--r-- | searx/https_rewrite.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/https_rewrite.py b/searx/https_rewrite.py index b2731ae28..9faf3599d 100644 --- a/searx/https_rewrite.py +++ b/searx/https_rewrite.py @@ -18,7 +18,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. import re from lxml import etree from os import listdir -from os.path import isfile, join +from os.path import isfile, isdir, join # https://gitweb.torproject.org/\ @@ -120,9 +120,10 @@ def load_single_https_ruleset(filepath): # load all https rewrite rules def load_https_rules(rules_path): - # add / to path if not set yet - if rules_path[-1:] != '/': - rules_path += '/' + # check if directory exists + if not isdir(rules_path): + print("[E] directory not found: '" + rules_path + "'") + return # search all xml files which are stored in the https rule directory xml_files = [join(rules_path, f) |