From 1b05e03384cbf686a9a372a192bac9ab13197465 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 05:18:09 +0000 Subject: [PATCH] jira - fixed base64 decode bug (#2349) (#2350) * fixed base64 decode bug * added changelog fragment (cherry picked from commit 8ddb81a36f755849e8c90a82612271719f19d0a8) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/2349-jira-bugfix-b64decode.yml | 2 ++ plugins/modules/web_infrastructure/jira.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2349-jira-bugfix-b64decode.yml diff --git a/changelogs/fragments/2349-jira-bugfix-b64decode.yml b/changelogs/fragments/2349-jira-bugfix-b64decode.yml new file mode 100644 index 0000000000..41a1dabb94 --- /dev/null +++ b/changelogs/fragments/2349-jira-bugfix-b64decode.yml @@ -0,0 +1,2 @@ +bugfixes: + - jira - fixed error when loading base64-encoded content as attachment (https://github.com/ansible-collections/community.general/pull/2349). diff --git a/plugins/modules/web_infrastructure/jira.py b/plugins/modules/web_infrastructure/jira.py index d7c88c01b8..3c1a8a27c9 100644 --- a/plugins/modules/web_infrastructure/jira.py +++ b/plugins/modules/web_infrastructure/jira.py @@ -596,7 +596,7 @@ def _prepare_attachment(filename, content=None, mime_type=None): content = f.read() else: try: - content = base64.decode(content) + content = base64.b64decode(content) except binascii.Error as e: raise Exception("Unable to base64 decode file content: %s" % e)