Catch unicode unescape failures in copy action plugin

pull/4420/head
James Tanner 2014-03-17 12:14:29 -04:00
parent 12c812f030
commit ebb6b8442b
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class ActionModule(object):
# now we need to unescape it so that the newlines are evaluated properly
# when writing the file to disk
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:
result=dict(failed=True, msg="src (or content) and dest are required")