Skip to content

Commit 6c40df2

Browse files
committed
Fix get_attachment_content to use URL from attachment metadata
1 parent 94f60a0 commit 6c40df2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

atlassian/jira.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,16 @@ def get_attachment_content(self, attachment_id: T_id) -> bytes:
366366
:param attachment_id: int
367367
:return: content as bytes
368368
"""
369-
base_url = self.resource_url("attachment")
370-
url = f"{base_url}/content/{attachment_id}"
371-
return self.get(url, not_json_response=True)
369+
attachment_info = self.get_attachment(attachment_id)
370+
if attachment_info is None:
371+
return b""
372+
url = attachment_info["content"]
373+
return self.get(
374+
url,
375+
not_json_response=True,
376+
absolute=True,
377+
headers={"Accept": "*/*"},
378+
)
372379

373380
def remove_attachment(self, attachment_id: T_id) -> T_resp_json:
374381
"""

0 commit comments

Comments
 (0)