mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Fixed issue with string parameters between quotes that do not have a
space
This commit is contained in:
parent
fbcaab2aba
commit
39a6d4860c
@ -236,8 +236,20 @@ class CommandManager(mitmproxy.types._CommandBase):
|
||||
parts, _ = self.parse_partial(cmdstr)
|
||||
params = []
|
||||
for p in parts:
|
||||
if p.value.strip() != '':
|
||||
params.append(p.value)
|
||||
v = p.value.strip()
|
||||
if v != '':
|
||||
if ((v.startswith("'") and v.endswith("'")) or
|
||||
(v.startswith("\"") and v.endswith("\""))) and \
|
||||
len(v.split(' ')) == 1:
|
||||
# If this parameter is between quotes but has no spaces in
|
||||
# it, then it is safe to remove the quotes to pass it down
|
||||
# This allows any commands that take a simple spaceless
|
||||
# string as a parameter to work. For example
|
||||
# view.flows.create get "http://www.example.com" won't work
|
||||
# if the quotes are there as it won't see the param as a URL
|
||||
v = v[1:-1]
|
||||
|
||||
params.append(v)
|
||||
|
||||
if len(parts) == 0:
|
||||
raise exceptions.CommandError("Invalid command: %s" % cmdstr)
|
||||
|
Loading…
Reference in New Issue
Block a user