Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
6.12.2
-
None
-
1
-
Severity 3 - Minor
-
Description
Summary
When creating a page via a REST call, if the storage format has an attachment, then that attachment is lost on subsequent edits of the page via the UI, even though it displays correctly on first view.
Steps to Reproduce
- Create a page via REST call with an embedded attachment (here, an image)
create page
curl -s -u admin:admin -H 'Content-Type: application/json' -d '{"type":"page","title":"my page","space":{"key":"KEY"},"body":{"storage":{"value":"<p>This is a new page</p><p><ac:image ac:thumbnail=\"true\" ac:height=\"250\"><ri:attachment ri:filename=\"meeple.png\" /></ac:image></p>","representation":"storage"}}}' http://localhost:8090/rest/api/content/
- Upload the attachment (change page id as required)
upload attachment
curl -s -u admin:admin -H "X-Atlassian-Token: no-check" -F "file=@meeple.png" -F "comment=this is my meeple" "http://localhost:8090/rest/api/content/327714/child/attachment"
- Edit the page through the browser to make a change.
Expected Results
The image stays attached to the page and displays correctly.
Actual Results
The image appears as a Broken Attachment both in view and edit
Workaround
Create the page with dummy content, upload the attachment and then update the page with the correct content.
create page
curl -s -u admin:admin -H 'Content-Type: application/json' -d '{"type":"page","title":"my page","space":{"key":"KEY"},"body":{"storage":{"value":"<p>This is a page holder</p>","representation":"storage"}}}' http://localhost:8090/rest/api/content/
upload attachment
curl -s -u admin:admin -H "X-Atlassian-Token: no-check" -F "file=@meeple.png" -F "comment=this is my meeple" "http://localhost:8090/rest/api/content/327714/child/attachment"
update page content
curl -s -u admin:admin -X PUT -H 'Content-Type: application/json' -d '{"id":"327714","type":"page","title":"my page", "body":{"storage":{"value": "<p>This is a new page</p><p><ac:image ac:thumbnail=\"true\" ac:height=\"250\"><ri:attachment ri:filename=\"meeple.png\" /></ac:image></p>","representation":"storage"}},"version":{"number":2}}' http://localhost:8090/rest/api/content/327714