mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Fixes #6227 skip non-unicode strings and catch decode errors silently in template_from_string
This commit is contained in:
parent
8eb547edaa
commit
ad70e9bcd6
1 changed files with 7 additions and 1 deletions
|
@ -310,7 +310,13 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
|
|||
if os.path.exists(filesdir):
|
||||
basedir = filesdir
|
||||
|
||||
data = data.decode('utf-8')
|
||||
# 6227
|
||||
if isinstance(data, unicode):
|
||||
try:
|
||||
data = data.decode('utf-8')
|
||||
except UnicodeEncodeError, e:
|
||||
pass
|
||||
|
||||
try:
|
||||
t = environment.from_string(data)
|
||||
except Exception, e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue