aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-05-01 12:45:28 +0200
committerGitHub <noreply@github.com>2020-05-01 12:45:28 +0200
commita802899491ba87218d7878bc4ac73dcf59c9275e (patch)
tree79f93adb6287f48379df549b5f2ea85b3b5bd550
parent1348ef7de811bd8416286664ec6e0bdce20636d0 (diff)
parent4dd9abd6a9df35ef6b6488cccdd3b4a7f80c094a (diff)
downloadmitmproxy-a802899491ba87218d7878bc4ac73dcf59c9275e.tar.gz
mitmproxy-a802899491ba87218d7878bc4ac73dcf59c9275e.tar.bz2
mitmproxy-a802899491ba87218d7878bc4ac73dcf59c9275e.zip
Merge pull request #3956 from sarthak212/consoleerror
console error
-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):