Catch unicode unescape failures in copy action plugin

pull/6531/head
James Tanner 11 years ago
parent 12c812f030
commit ebb6b8442b

@ -58,7 +58,11 @@ class ActionModule(object):
# now we need to unescape it so that the newlines are evaluated properly # now we need to unescape it so that the newlines are evaluated properly
# when writing the file to disk # when writing the file to disk
if content: if content:
content = content.decode('unicode-escape') if isinstance(content, unicode):
try:
content = content.decode('unicode-escape')
except UnicodeDecodeError:
pass
if (source is None and content is None and not 'first_available_file' in inject) or dest is None: if (source is None and content is None and not 'first_available_file' in inject) or dest is None:
result=dict(failed=True, msg="src (or content) and dest are required") result=dict(failed=True, msg="src (or content) and dest are required")

Loading…
Cancel
Save