mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Use bytes rather than native string for result (#46281)
This prevents a stack trace in Python 3 when the result is an empty file since the file is open in binary mode and a native string in Python 3 is str, not bytes.
This commit is contained in:
parent
2d01966e87
commit
8b1ae30e2e
3 changed files with 73 additions and 24 deletions
|
@ -309,7 +309,7 @@ def main():
|
|||
if original is None or original.endswith(b('\n')):
|
||||
result += b('\n')
|
||||
else:
|
||||
result = ''
|
||||
result = b''
|
||||
|
||||
if module._diff:
|
||||
diff['after'] = result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue