aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/command_lexer.py4
-rw-r--r--test/mitmproxy/test_command_lexer.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/mitmproxy/command_lexer.py b/mitmproxy/command_lexer.py
index f042f3c9..31458f4d 100644
--- a/mitmproxy/command_lexer.py
+++ b/mitmproxy/command_lexer.py
@@ -12,9 +12,9 @@ PartialQuotedString = pyparsing.Regex(
r'''
(["']) # start quote
(?:
- (?!\1)[^\\] # unescaped character that is not our quote nor the begin of an escape sequence. We can't use \1 in []
- |
(?:\\.) # escape sequence
+ |
+ (?!\1). # unescaped character that is not our quote nor the begin of an escape sequence. We can't use \1 in []
)*
(?:\1|$) # end quote
''',
diff --git a/test/mitmproxy/test_command_lexer.py b/test/mitmproxy/test_command_lexer.py
index cdda1085..ec994087 100644
--- a/test/mitmproxy/test_command_lexer.py
+++ b/test/mitmproxy/test_command_lexer.py
@@ -16,6 +16,7 @@ from mitmproxy import command_lexer
("'foo'x", False),
('''"foo ''', True),
('''"foo 'bar' ''', True),
+ ('"foo\\', True),
]
)
def test_partial_quoted_string(test_input, valid):
@@ -34,6 +35,7 @@ def test_partial_quoted_string(test_input, valid):
("'foo'x", ["'foo'", 'x']),
('''"foo''', ['"foo']),
('''"foo 'bar' ''', ['''"foo 'bar' ''']),
+ ('"foo\\', ['"foo\\']),
]
)
def test_expr(test_input, expected):