mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
Allow non-breaking spaces in nginx config files (#10126)
Fixes @josevavia's issue in #9942.
This commit is contained in:
@@ -35,8 +35,8 @@ class RawNginxParser:
|
||||
"""A class that parses nginx configuration with pyparsing."""
|
||||
|
||||
# constants
|
||||
space = Optional(White()).leaveWhitespace()
|
||||
required_space = White().leaveWhitespace()
|
||||
space = Optional(White(ws=' \t\r\n\u00a0')).leaveWhitespace()
|
||||
required_space = White(ws=' \t\r\n\u00a0').leaveWhitespace()
|
||||
|
||||
left_bracket = Literal("{").suppress()
|
||||
right_bracket = space + Literal("}").suppress()
|
||||
|
||||
@@ -362,6 +362,18 @@ class TestRawNginxParser(unittest.TestCase):
|
||||
parsed = loads("")
|
||||
assert parsed == []
|
||||
|
||||
def test_non_breaking_spaces(self):
|
||||
# non-breaking spaces
|
||||
test = u'\u00a0'
|
||||
loads(test)
|
||||
test = """
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
"""
|
||||
loads(test)
|
||||
|
||||
|
||||
class TestUnspacedList(unittest.TestCase):
|
||||
"""Test the UnspacedList data structure"""
|
||||
|
||||
@@ -11,7 +11,7 @@ install_requires = [
|
||||
f'certbot>={version}',
|
||||
# pyOpenSSL 23.1.0 is a bad release: https://github.com/pyca/pyopenssl/issues/1199
|
||||
'PyOpenSSL>=17.5.0,!=23.1.0',
|
||||
'pyparsing>=2.2.1',
|
||||
'pyparsing>=2.4.7',
|
||||
]
|
||||
|
||||
test_extras = [
|
||||
|
||||
Reference in New Issue
Block a user