No closing image tag in html pulled from Confluence page Edited

Hi, I'm working on a python script that pulls down the html from a confluence page, replaces certain filenames with image attachment macros, and posts the updated html to the page.

This works the first time I run it on the page template, but when I run it a second time on the page updated with image macros it fails because of an error in the html (no closing img tag). This is funny because the second time it just pulls the html from the page, it is reposting the html without any changes.

The html of the image macro that I am posting to the page (and is on the page after the first run according to the edit <> screen) is


<ac:image><ri:attachment ri:filename="filename.png"/></ac:image>

However, on the second run the html that is being pulled from the page is this:

<span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="/confluence/download/attachments/59559......></span>

The page is not being reuploaded due to the error that it is expecting a </img>. Any ideas as to why there isn't a closing image tag on the html I'm pulling down? Should I just regex those img tags and add closing tags to the html before I post, or is there another solution to this?


UPDATE:  I got it working by using regex and adding </img> tags where necessary. I'm still curious as to why the html coming from Confluence is missing these tags.




0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,037 views 15 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you