Skip to content

fix: [Confluence] download_attachments_from_page: the return value from the response is bytes. #1510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,17 +1470,17 @@
file_name = attachment["title"] or attachment["id"] # Use attachment ID if title is unavailable
download_link = self.url + attachment["_links"]["download"]
# Fetch the file content
response = self.get(str(download_link))
response = self.get(str(download_link), not_json_response=True)

Check warning on line 1473 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1473

Added line #L1473 was not covered by tests

if to_memory:
# Store in BytesIO object
file_obj = io.BytesIO(response.content)
file_obj = io.BytesIO(response)

Check warning on line 1477 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1477

Added line #L1477 was not covered by tests
downloaded_files[file_name] = file_obj
else:
# Save file to disk
file_path = os.path.join(path, file_name)
with open(file_path, "wb") as file:
file.write(response.content)
file.write(response)

Check warning on line 1483 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1483

Added line #L1483 was not covered by tests

# Return results based on storage mode
if to_memory:
Expand Down