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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

380 views 21 10
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