kovetskiy / mark

Sync your markdown files with Confluence pages.
https://samizdat.dev
Apache License 2.0
1.02k stars 154 forks source link

Cannot update document with attachment more than 50 #178

Closed ToruKawaguchi closed 2 months ago

ToruKawaguchi commented 2 years ago

I have a document with 53 attachment. I could upload it correctly, but could not update it with mark showing following error.

2022-04-21 14:21:51 [FATAL]: unable to create/update attachments
                             └─ unable to create attachment "images/test001.jpg"
                                └─ Confluence API returned unexpected status: 400 Bad Request, output: ""

No attachment was changed but it seems that mark handles the attachment as a new file.

I suspect that the following line might be the cause:

https://github.com/kovetskiy/mark/blob/2f34e9397368cd5c423dac6fc6db4a0be436195c/pkg/confluence/api.go#L429-L431

because corresponding Confluence API uses paging and returns maximum of 50 attachment by default.

https://docs.atlassian.com/ConfluenceServer/rest/7.17.1/#content/{id}/child/attachment-getAttachments

I would applicate if the team could handle this.

kovetskiy commented 2 years ago

Hi! You probably are right about the default limit. On the other hand, mark is an open source program and relies on community contributions, I'll be glad to merge a PR that addresses the issue.

nicolaasuni-vonage commented 2 years ago

@kovetskiy Any chance you have a minute to approve the PR that fixes this issue? https://github.com/kovetskiy/mark/pull/220 Thank you.

ToruKawaguchi commented 2 years ago

@nicolaasuni-vonage Thanks for your PR!

mrueg commented 2 months ago

Closing as fixed as a workaround exists.