Test unquote works as expected and fix two bugs:

* escaped end quote
* a single quote character
This commit is contained in:
Toshio Kuratomi 2015-07-06 13:15:11 -07:00
parent 0cd7942155
commit f44f9569e1
2 changed files with 59 additions and 1 deletions

View file

@ -264,7 +264,7 @@ def split_args(args):
return params
def is_quoted(data):
return len(data) > 0 and (data[0] == '"' and data[-1] == '"' or data[0] == "'" and data[-1] == "'")
return len(data) > 1 and data[0] == data[-1] and data[0] in ('"', "'") and data[-2] != '\\'
def unquote(data):
''' removes first and last quotes from a string, if the string starts and ends with the same quotes '''