mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
web proxy: fix setting unknown directory
Not great, needs a full refactor.
This commit is contained in:
parent
e76bc6ead8
commit
3f25fa25ab
@ -182,10 +182,10 @@ class Helpers(object):
|
||||
:return: bool
|
||||
"""
|
||||
if pathname.startswith('/'):
|
||||
return os.path.isfile(pathname)
|
||||
return os.path.exists(pathname)
|
||||
else:
|
||||
template_path = os.path.realpath("%s/../../templates/" % os.path.dirname(__file__))
|
||||
return os.path.isfile("%s/%s" % (template_path, pathname))
|
||||
return os.path.exists("%s/%s" % (template_path, pathname))
|
||||
|
||||
@staticmethod
|
||||
def glob(pathname):
|
||||
|
||||
@ -468,9 +468,19 @@ cache_mgr {{OPNsense.proxy.general.VisibleEmail}}
|
||||
# Set connection timeout
|
||||
connect_timeout {{OPNsense.proxy.general.connecttimeout}} seconds
|
||||
{% endif %}
|
||||
# Set error directory language
|
||||
{% if not helpers.empty('OPNsense.proxy.general.error_pages') %}
|
||||
error_directory /usr/local/etc/squid/errors/local
|
||||
{% elif helpers.exists('system.language') and system.language != "" %}
|
||||
# XXX this can end up selecting a nonexistent directory because most languages are without a country shortcut
|
||||
error_directory /usr/local/share/squid-langpack/{{ system.language|lower|replace("_","-")}}
|
||||
{% set langdir = system.language|lower|replace('_', '-') %}
|
||||
{% if helpers.file_exists('/usr/local/share/squid-langpack/' + langdir) %}
|
||||
error_directory /usr/local/share/squid-langpack/{{ langdir }}
|
||||
{% else %}
|
||||
{% set langdir = langdir[:2] %}
|
||||
{% if helpers.file_exists('/usr/local/share/squid-langpack/' + langdir) %}
|
||||
error_directory /usr/local/share/squid-langpack/{{ langdir }}
|
||||
{% else %}
|
||||
error_directory /usr/local/etc/squid/errors/local
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user