mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Catch unicode unescape failures in copy action plugin
This commit is contained in:
parent
12c812f030
commit
ebb6b8442b
1 changed files with 5 additions and 1 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue