No closing image tag in html pulled from Confluence page

Garrick Larson July 6, 2017

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
TAGS
AUG Leaders

Atlassian Community Events