Issue Summary
Forge app has a macro with an adfExport function that returns a mediaSingle ADF node. This node points to an image file that is attached to a custom content that is a child of a page with the macro.
When this page is exported the attached image is not displayed and `Preview unavailable` box is displayed instead.
Steps to Reproduce
- Run steps from the attached test app's README file to install the app to a site.
- Create a new page.
- App provides a custom content that needs to be created as a child of the page. First we need to find out the full custom content type to use. To do this run the query: https://<site>/wiki/rest/api/content/<page-id>?expand=childTypes. You should see something like: forge_cf32ad0f_a848_445a_82a6_92d40e3e74def0ef424c_889e_4e48_9619_d508d9585fbb_dummy_custom_content.
- In the custom content type above replace all double underscores to colons ("__" to ":") and single underscores to dashes ("_" to "-"). So the result type is in the following format: forge:cf32ad0f-a848-445a-82a6-92d40e3e74de:f0ef424c-889e-4e48-9619-d508d9585fbb:dummy-custom-content
- Create a custom content of this type as a child of the created page using the query below. Copy the result custom content id.
curl --location 'https://<site>/wiki/api/v2/custom-content' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic <API_TOKEN>' \ --data '{ "type": "forge:cf32ad0f-a848-445a-82a6-92d40e3e74de:f0ef424c-889e-4e48-9619-d508d9585fbb:dummy-custom-content", "status": "current", "pageId": "<page-id>", "title": "Dummy custom content page 1", "body": { "representation": "storage", "value": "" } }'
- Attach any image to the result custom content using the following query:
curl --location 'https://<site>/wiki/rest/api/content/<custom-content-id>/child/attachment' \ --header 'Accept: application/json' \ --header 'X-Atlassian-Token: nocheck' \ --header 'Authorization: Basic <API_TOKEN>' \ --form 'file=@"/full/path/to/file/image.png"'
- From the response copy the following field value: results[0].extensions.fileId. For example a72ed967-e4ba-40e0-b830-3b71e43ac156.
- Edit the page created on step 2 via Confluence UI. Insert media-adf-macro macro from the installed app.
- In macro parameters copy paste the custom content id, file id and file name from steps 5, 6 and 7. Make sure all of them are displayed in the macro.
- Save the page.
- Open the following PDF export link: https://<site>/wiki/pdf/spaces/<space-key>/pages/<page-id>.
- Observe Preview unavailable snippet instead of the macro.
Expected Results
Image attached to a custom content is rendered.
Actual Results
Preview unavailable box is displayed instead of the macro
Workaround
As a possible workaround (temporary?) for this bug, the app could add the attachment directly to the page and not to the child custom content. The fact that it's rendered correctly in this case can be verified with the same steps above, but you can skip steps 3-5 and on step 6 attach an image to the page itself instead of custom content.
- mentioned in
-
Page Loading...