Commit ef2d37ed authored by Romain Courteaud's avatar Romain Courteaud

PloneHotfix20121106: catch a ValueError exception

unescape_chr is executed with such string: "C:\Program Files\1234.jpg".
Prevent failing, and return original string in such case.
parent 4c743377
......@@ -8,7 +8,10 @@ ENTITYREF_RE = re.compile(r"&(\w{1,32});?")
CHR_RE = re.compile(r'\\(\d+)')
def unescape_chr(matchobj):
return chr(int(matchobj.group(1), 16))
try:
return chr(int(matchobj.group(1), 16))
except ValueError:
return matchobj.group(1)
def decode_charref(s):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment