Html admin api incorrectly parse figure with a href as img

I have figure with link:

<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/?ref=preciselab.io"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Install MongoDB Community Edition on Red Hat or CentOS — MongoDB Manual</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.mongodb.com/docs/assets/favicon.ico"></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.mongodb.com/docs/assets/meta_generic.png"></div></a></figure>

When I am using /ghost/api/admin/posts/?source=html then this is parsed as

<figure class="kg-card kg-image-card"><img src="https://www.mongodb.com/docs/assets/favicon.ico" class="kg-image" alt="" loading="lazy"></figure>

and my url is lost

1 Like

I have the same issue.

Ghost version- 5.75.2
@tryghost/admin-api- 1.13.2

Code to reproduce:

const postsRaw = await api.posts.browse({ formats: 'html', limit: 'all' })
for await (const post of postsRaw) {
    try {
		await api.posts.edit({ id: post.id, updated_at: post?.updated_at, html: post.html }, { source: 'html' })
	} catch (e) {
		console.log(`Error while updating post ${(post.id}!`, e)
	}
}