Details
-
Bug
-
Resolution: Fixed
-
Medium
-
Minor
-
Description
Issue Summary
There is some conflict when copying a page with both attachment and content properties which are already exist in the destination page when "existing_page" destination type is used.
Steps to Reproduce
I was able to reproduce it on the production instance with "Comala Document Control for Confluence Cloud" app installed (adds content properties to the page).
- Install "Comala Document Control for Confluence Cloud" to your instance.
- Create a new page in any space.
- Attach a file to this page.
- From page's meatballs menu select "Add Page Workflow" with default options.
- Copy this page to another parent page using the Copy Page API with "copyProperties" and "copyAttachments" flags:
POST <baseurl>/wiki/rest/api/content/<source_page_id>/copy { "destination": { "type": "parent_page", "value": "<parent_id>" }, "copyAttachments": true, "copyProperties": true }
It should be successfully copied and create new page with <new_page_id>.
- Copy the source page again, but now with "existing_page" destination type to <new_page_id> with "copyContentProperties" and "copyAttachments" flags:
POST <baseurl>/wiki/rest/api/content/<source_page_id>/copy { "destination": { "type": "existing_page", "value": "<new_page_id>" }, "copyAttachments": true, "copyProperties": true }
Expected Results
Page is copied successfully.
Actual Results
Three possible scenarios:
A. Attachment's size is small (tested with 1KB):
Request completes successfully.
B. Attachment's size is medium (tested with 700KB image):
Request fails with the following response:
{ "statusCode": 500, "message": "com.atlassian.confluence.core.persistence.confluence.StaleObjectStateException: javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1" }
C. Attachment's size is big (tested with 1.6Mb file):
Request fails with the following response:
{ "statusCode": 409, "data": { "authorized": false, "valid": true, "errors": [], "successful": false }, "message": "com.atlassian.confluence.api.service.exceptions.ConflictException: You're trying to edit an outdated version of that ContentProperty. Latest version is 11" }
Removing attachment helps to resolve the issue as well as removing the "copyProperties" flag.
Exception stack trace is attached.
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available