Fix llUnescapeURL with % in place of the second hex character.
When the input was of the form e.g. "%4%40", the second "%" was erroneously starting another quoted character. LSL doesn't behave that way: parsing resumes without starting another quoted character. Disturbingly, the expected result in the corresponding test was wrong. Fixed both the test case and the code to match actual LSL behaviour.
This commit is contained in:
@@ -1757,6 +1757,7 @@ def llUnescapeURL(s):
|
||||
c = s[i] # Second digit
|
||||
if c == u'%':
|
||||
ret += chr(v)
|
||||
i += 1
|
||||
continue
|
||||
i += 1
|
||||
if u'0' <= c <= u'9' or u'A' <= c <= u'F' or u'a' <= c <= u'f':
|
||||
|
||||
@@ -1302,7 +1302,7 @@ def do_tests():
|
||||
|
||||
test('llUnescapeURL(u"%")', u'')
|
||||
test('llUnescapeURL(u"%%")', u'')
|
||||
test('llUnescapeURL(u"%4%252Fabc")', u'\x40\x252Fabc')
|
||||
test('llUnescapeURL(u"%4%252Fabc")', u'\x40252Fabc')
|
||||
test('llUnescapeURL(u"%%4%252Fabc")', u'\x04\x252Fabc')
|
||||
test('llEscapeURL(llUnescapeURL(u"%.44%25%%2Fa\u2190c"))', u'%044%25%02Fa%E2%86%90c')
|
||||
test('llEscapeURL(llUnescapeURL(u"%.44%25%%2Fa\u2190c%"))', u'%044%25%02Fa%E2%86%90c')
|
||||
|
||||
Reference in New Issue
Block a user