Skip to content

Commit cca91e9

Browse files
authored
fix: the return value from the response is bytes.
- Adjusted the download logic to process the file content directly as bytes.
1 parent c2f3382 commit cca91e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

atlassian/confluence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,17 +1470,17 @@ def download_attachments_from_page(self, page_id, path=None, start=0, limit=50,
14701470
file_name = attachment["title"] or attachment["id"] # Use attachment ID if title is unavailable
14711471
download_link = self.url + attachment["_links"]["download"]
14721472
# Fetch the file content
1473-
response = self.get(str(download_link))
1473+
response = self.get(str(download_link), not_json_response=True)
14741474

14751475
if to_memory:
14761476
# Store in BytesIO object
1477-
file_obj = io.BytesIO(response.content)
1477+
file_obj = io.BytesIO(response)
14781478
downloaded_files[file_name] = file_obj
14791479
else:
14801480
# Save file to disk
14811481
file_path = os.path.join(path, file_name)
14821482
with open(file_path, "wb") as file:
1483-
file.write(response.content)
1483+
file.write(response)
14841484

14851485
# Return results based on storage mode
14861486
if to_memory:

0 commit comments

Comments
 (0)