mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 18:04:31 +02:00
Allow single/double quotes around Include dirs
This commit is contained in:
@@ -390,6 +390,9 @@ class ApacheParser(object):
|
|||||||
# logger.error("Error: Invalid regexp characters in %s", arg)
|
# logger.error("Error: Invalid regexp characters in %s", arg)
|
||||||
# return []
|
# return []
|
||||||
|
|
||||||
|
# Remove beginning and ending quotes
|
||||||
|
arg = arg.strip("'\"")
|
||||||
|
|
||||||
# Standardize the include argument based on server root
|
# Standardize the include argument based on server root
|
||||||
if not arg.startswith("/"):
|
if not arg.startswith("/"):
|
||||||
# Normpath will condense ../
|
# Normpath will condense ../
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ComplexParserTest(util.ParserTest):
|
|||||||
# This is in an IfDefine
|
# This is in an IfDefine
|
||||||
self.assertTrue("ssl_module" in self.parser.modules)
|
self.assertTrue("ssl_module" in self.parser.modules)
|
||||||
self.assertTrue("mod_ssl.c" in self.parser.modules)
|
self.assertTrue("mod_ssl.c" in self.parser.modules)
|
||||||
|
#
|
||||||
def verify_fnmatch(self, arg, hit=True):
|
def verify_fnmatch(self, arg, hit=True):
|
||||||
"""Test if Include was correctly parsed."""
|
"""Test if Include was correctly parsed."""
|
||||||
from letsencrypt_apache import parser
|
from letsencrypt_apache import parser
|
||||||
@@ -89,6 +89,7 @@ class ComplexParserTest(util.ParserTest):
|
|||||||
else:
|
else:
|
||||||
self.assertFalse(self.parser.find_dir("FNMATCH_DIRECTIVE"))
|
self.assertFalse(self.parser.find_dir("FNMATCH_DIRECTIVE"))
|
||||||
|
|
||||||
|
# NOTE: Only run one test per function otherwise you will have inf recursion
|
||||||
def test_include(self):
|
def test_include(self):
|
||||||
self.verify_fnmatch("test_fnmatch.?onf")
|
self.verify_fnmatch("test_fnmatch.?onf")
|
||||||
|
|
||||||
@@ -101,6 +102,12 @@ class ComplexParserTest(util.ParserTest):
|
|||||||
def test_include_fullpath_trailing_slash(self):
|
def test_include_fullpath_trailing_slash(self):
|
||||||
self.verify_fnmatch(self.config_path + "//")
|
self.verify_fnmatch(self.config_path + "//")
|
||||||
|
|
||||||
|
def test_include_single_quotes(self):
|
||||||
|
self.verify_fnmatch("'" + self.config_path + "'")
|
||||||
|
|
||||||
|
def test_include_double_quotes(self):
|
||||||
|
self.verify_fnmatch('"' + self.config_path + '"')
|
||||||
|
|
||||||
def test_include_variable(self):
|
def test_include_variable(self):
|
||||||
self.verify_fnmatch("../complex_parsing/${fnmatch_filename}")
|
self.verify_fnmatch("../complex_parsing/${fnmatch_filename}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user