The following changes have been done in order to publish content on an Atlassian Cloud Confluence instance (Confluence 1000.904.0).
In confluence.py the publish function of the AttachmentPublisher has been modified:
it allows to list 50 attachments by page and so alleviate the current limit of 25 attachments by page. It does this by calling the _api.list_attachments method instead of _get_page_metadata. The former return 50 attachments by default and the later 25 on my Confluence instance. The limit of 50 is a default set by the signature of _api.list_attachments, it could be changed or configurable. The check for existing attachments could be improved.
the mime type of each attachment is now computed from the filename
the mime type and the filename of each attachment is now also sent to _api.create_attachment and subsequently to _api._create_attachment.
In confluence_api.py, the _create_attachment method now send the mime-type, the binary data and the name of each attachment to the Confluence REST API.
Also in confluence_api.py, the return type of list_attachments has been changed to return only the results part of the response of the REST API. Perhaps it is not advisable, but i have seen no other use of the _api.list_attachments method in the code than in the new implementation of AttachmentPublisher.publish proposed here.
I hope to not have broke anything with previous versions of Confluence, and should probably create a new ConfluenceRestApi, let me know.
The following changes have been done in order to publish content on an Atlassian Cloud Confluence instance (Confluence 1000.904.0).
In
confluence.py
thepublish
function of theAttachmentPublisher
has been modified:_api.list_attachments
method instead of_get_page_metadata
. The former return 50 attachments by default and the later 25 on my Confluence instance. The limit of 50 is a default set by the signature of_api.list_attachments
, it could be changed or configurable. The check for existing attachments could be improved._api.create_attachment
and subsequently to_api._create_attachment
.In
confluence_api.py
, the_create_attachment
method now send the mime-type, the binary data and the name of each attachment to the Confluence REST API.Also in
confluence_api.py
, the return type oflist_attachments
has been changed to return only theresults
part of the response of the REST API. Perhaps it is not advisable, but i have seen no other use of the_api.list_attachments
method in the code than in the new implementation ofAttachmentPublisher.publish
proposed here.I hope to not have broke anything with previous versions of Confluence, and should probably create a new ConfluenceRestApi, let me know.
Thanks for your time, Best regards.