Attachment preview is showing "Failed to load" after page is manually edited

Sava Kezic
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 25, 2024

I am creating pages automatically (programmatically), and in my pages I have file (attachment) preview macros which are pointing to attachments that I upload (also programmatically) after my page is created. When I open a page, to check what has been created, everything works fine, file previews are presenting attachments correctly. But if I manually edit (click on pen) the page, without touching macros, all file preview macros start showing "Failed to load". And when I check the page content through API for file preview macro it is returning:

<ri:attachment ri:filename=\"UNKNOWN_ATTACHMENT\" ri:version-at-save=\"1\" /> .
Steps:
1. Create page with content including file (attachment) preview macros through API
2. Upload attachments through API
3. Try to edit page manually in Confluence
4. While and after editing the page file (attachment) preview macros start showing "Failed to load"
Conclusion:
File  (attachment) preview macros only work if I do not manually edit page in Confluence.
Jinja2 template for file preview macro:
<p class="media-group">
    <ac:structured-macro ac:name="view-file" ac:schema-version="1">
        <ac:parameter ac:name="name">
            <ri:attachment ri:filename="{{attachment}}" />
        </ac:parameter>
    </ac:structured-macro>
</p>
Screenshot 2024-01-25 111155.pngScreenshot 2024-01-25 111225.pngScreenshot 2024-01-25 111241.png

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events