mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 16:15:42 +02:00
Added None check and according test
This commit is contained in:
@@ -538,6 +538,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
||||
is_ssl = True
|
||||
|
||||
filename = get_file_path(self.aug.get("/augeas/files%s/path" % get_file_path(path)))
|
||||
if filename is None:
|
||||
return None
|
||||
|
||||
if self.conf("handle-sites"):
|
||||
is_enabled = self.is_site_enabled(filename)
|
||||
else:
|
||||
@@ -1802,7 +1805,10 @@ def get_file_path(vhost_path):
|
||||
|
||||
"""
|
||||
# Strip off /files/
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
try:
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
except TypeError:
|
||||
return None
|
||||
last_good = ""
|
||||
# Loop through the path parts and validate after every addition
|
||||
for p in avail_fp:
|
||||
|
||||
@@ -125,6 +125,10 @@ class MultipleVhostsTest(util.ApacheTest):
|
||||
self.assertTrue("google.com" in names)
|
||||
self.assertTrue("certbot.demo" in names)
|
||||
|
||||
def test_get_bad_path(self):
|
||||
from certbot_apache.configurator import get_file_path
|
||||
self.assertEqual(get_file_path(None), None)
|
||||
|
||||
def test_bad_servername_alias(self):
|
||||
ssl_vh1 = obj.VirtualHost(
|
||||
"fp1", "ap1", set([obj.Addr(("*", "443"))]),
|
||||
|
||||
Reference in New Issue
Block a user