mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 00:00:44 +02:00
Added check for /files/
This commit is contained in:
@@ -1806,9 +1806,14 @@ def get_file_path(vhost_path):
|
||||
"""
|
||||
# Strip off /files/
|
||||
try:
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
except TypeError:
|
||||
if vhost_path.startswith("/files/"):
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
else:
|
||||
return None
|
||||
except AttributeError:
|
||||
# If we recieved a None path
|
||||
return None
|
||||
|
||||
last_good = ""
|
||||
# Loop through the path parts and validate after every addition
|
||||
for p in avail_fp:
|
||||
|
||||
@@ -128,6 +128,7 @@ class MultipleVhostsTest(util.ApacheTest):
|
||||
def test_get_bad_path(self):
|
||||
from certbot_apache.configurator import get_file_path
|
||||
self.assertEqual(get_file_path(None), None)
|
||||
self.assertEqual(get_file_path("nonexistent"), None)
|
||||
self.assertEqual(self.config._create_vhost("nonexistent"), None) # pylint: disable=protected-access
|
||||
|
||||
def test_bad_servername_alias(self):
|
||||
|
||||
Reference in New Issue
Block a user