mirror of
https://github.com/certbot/certbot.git
synced 2026-07-31 18:34:41 +02:00
Refactored get_file_path
This commit is contained in:
@@ -1801,25 +1801,17 @@ def get_file_path(vhost_path):
|
||||
:rtype: str
|
||||
|
||||
"""
|
||||
# Strip off /files
|
||||
avail_fp = vhost_path[6:]
|
||||
# This can be optimized...
|
||||
while True:
|
||||
# Cast all to lowercase to be case insensitive
|
||||
find_if = avail_fp.lower().find("/ifmodule")
|
||||
if find_if != -1:
|
||||
avail_fp = avail_fp[:find_if]
|
||||
continue
|
||||
find_vh = avail_fp.lower().find("/virtualhost")
|
||||
if find_vh != -1:
|
||||
avail_fp = avail_fp[:find_vh]
|
||||
continue
|
||||
find_macro = avail_fp.lower().find("/macro")
|
||||
if find_macro != -1:
|
||||
avail_fp = avail_fp[:find_macro]
|
||||
continue
|
||||
break
|
||||
return avail_fp
|
||||
# Strip off /files/
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
last_good = ""
|
||||
# Loop through the path parts and validate after every addition
|
||||
for p in avail_fp:
|
||||
cur_path = last_good+"/"+p
|
||||
if os.path.exists(cur_path):
|
||||
last_good = cur_path
|
||||
else:
|
||||
break
|
||||
return last_good
|
||||
|
||||
|
||||
def install_ssl_options_conf(options_ssl):
|
||||
|
||||
Reference in New Issue
Block a user