Attachment's get() method returns empty content for some attachments
Bug summary
Downloading does not work for every attachment. From the same issue, one file (.xlsx) is returned as expected the other file (.gif) is empty, i.a. get() returns b''.
Is there an existing issue for this?
- [X] I have searched the existing issues
Jira Instance type
Jira Server or Data Center (Self-hosted)
Jira instance version
7.13.8
jira-python version
main
Python Interpreter version
3.7
Which operating systems have you used?
- [ ] Linux
- [ ] macOS
- [X] Windows
Reproduction steps
# try getting the attachment
attachment = jira.attachment(1234)
print(attachment.get())
# prints "b''"
Stack trace
No error
Expected behaviour
I can download any attachment no matter the size or type.
Additional Context
Workaround:
attachment = jira.attachment(1234)
url = attachment.raw["content"]
r = requests.get(url, cookies=jira._session.cookies)
with open(destination, "wb") as f:
f.write(r.content)
@RED1869 can you let me know the size of the .gif file ? We can perhaps at least add a test for a gif of similar size to see if we can reproduce this
The .gif is about 530 kB in size, the .xlsx is about 50 kB. I also noticed that the response header of attachmet.get() contains 'X-Seraph-LoginReason': 'OUT, AUTHENTICATED_FAILED', whereas the response header of requests.get() contains i.a. the smsessoin cookie.