on master help sign in
Merge pull request #117 from pointhi/https_fix

print error if https rewrite directory is not found, #116

commit5656fc472c570c44bd2d971ab7862ac01ed6cf36 authorAdam Tauber <asciimoo@gmail.com> dateSun 19 Oct 2014, 21:48 (12 years ago) parent7be97596ecf03c
1 file changed+5−4
searx/https_rewrite.py+5−4
searx/https_rewrite.py+5−4
@@ -18,7 +18,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
1818import re
1919from lxml import etree
2020from os import listdir
21−from os.path import isfile, join
21+from os.path import isfile, isdir, join
2222
2323
2424# https://gitweb.torproject.org/\
@@ -120,9 +120,10 @@ def load_single_https_ruleset(filepath):
120120
121121# load all https rewrite rules
122122def load_https_rules(rules_path):
123− # add / to path if not set yet
124− if rules_path[-1:] != '/':
125− rules_path += '/'
123+ # check if directory exists
124+ if not isdir(rules_path):
125+ print("[E] directory not found: '" + rules_path + "'")
126+ return
126127
127128 # search all xml files which are stored in the https rule directory
128129 xml_files = [join(rules_path, f)