From 46d3ad37d09fb6e6789aec4dbfc87d1b87ae40f5 Mon Sep 17 00:00:00 2001 From: laszlojau <49835454+laszlojau@users.noreply.github.com> Date: Sat, 17 Jun 2023 21:52:00 +0930 Subject: [PATCH] Treat files as binary when downloading attachments --- plugins/lookup/tss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/tss.py b/plugins/lookup/tss.py index 1fe87b31ec..fb6fad4f37 100644 --- a/plugins/lookup/tss.py +++ b/plugins/lookup/tss.py @@ -289,8 +289,8 @@ class TSSClient(object): if file_download_path and os.path.isdir(file_download_path): if i['isFile']: try: - with open(os.path.join(file_download_path, str(obj['id']) + "_" + i['slug']), "w") as f: - f.write(i['itemValue'].text) + with open(os.path.join(file_download_path, str(obj['id']) + "_" + i['slug']), "wb") as f: + f.write(i['itemValue'].content) i['itemValue'] = "*** Not Valid For Display ***" except ValueError: raise AnsibleOptionsError("Failed to download {0}".format(str(i['slug'])))