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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

849 views 23 12
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