Skip to content
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

Confluence: add cloud support for attachment functions #1473

Merged
merged 1 commit into from
Nov 5, 2024
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
13 changes: 9 additions & 4 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,9 +1449,11 @@
:param version: file version
:return:
"""
return self.delete(
"rest/experimental/content/{id}/version/{versionId}".format(id=attachment_id, versionId=version)
)
if self.cloud:
url = "rest/api/content/{id}/version/{versionId}".format(id=attachment_id, versionId=version)

Check warning on line 1453 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1453

Added line #L1453 was not covered by tests
else:
url = "rest/experimental/content/{id}/version/{versionId}".format(id=attachment_id, versionId=version)
return self.delete(url)

Check warning on line 1456 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1455-L1456

Added lines #L1455 - L1456 were not covered by tests

def remove_page_attachment_keep_version(self, page_id, filename, keep_last_versions):
"""
Expand Down Expand Up @@ -1488,7 +1490,10 @@
:return
"""
params = {"limit": limit, "start": start}
url = "rest/experimental/content/{}/version".format(attachment_id)
if self.cloud:
url = "rest/api/content/{id}/version".format(id=attachment_id)

Check warning on line 1494 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1494

Added line #L1494 was not covered by tests
else:
url = "rest/experimental/content/{id}/version".format(id=attachment_id)

Check warning on line 1496 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L1496

Added line #L1496 was not covered by tests
return (self.get(url, params=params) or {}).get("results")

# @todo prepare more attachments info
Expand Down