Skip to content
New issue

Have a question about this project?Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html Admin API incorrectly parses figure with a href as img #19785

Closed
1 task done
PetromirDevopened this issue Mar 1, 2024 · 2 comments
Closed
1 task done

Html Admin API incorrectly parses figure with a href as img #19785

PetromirDevopened this issue Mar 1, 2024 · 2 comments
Labels
bug [triage] something behaving unexpectedly stale [triage] Issues that were closed to to lack of traction

Comments

@PetromirDev
Copy link

Issue Summary

Editing a post, using Ghost API, that has a figure with a link inside replaces the link with an image.

Steps to Reproduce

  1. Have a post with the following element in the content:
<figure class=\ "kg-card kg-bookmark-card\" ><a class=\ "kg-bookmark-container\" href=\ "__GHOST_URL__/article-url/\" ><div class=\ "kg-bookmark-content\" ><div class=\ "kg-bookmark-title\" >Some title</div><div class=\ "kg-bookmark-description\" >Some text</div><div class=\ "kg-bookmark-metadata\" ><img class=\ "kg-bookmark-icon\" src=\ "__GHOST_URL__/content/images/size/w256h256/2022/08/[email protected]\" alt=\ "\" ><span class=\ "kg-bookmark-author\" >Ghost Blog</span><span class=\ "kg-bookmark-publisher\" >Author</span></div></div><div class=\ "kg-bookmark-thumbnail\" ><img src=\ "__GHOST_URL__/content/images/2023/10/cover.jpg\" alt=\ "\" ></div></a></figure>
  1. Run this script:
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)
}
}
  1. The figure from above is replaced with:
<figure class=\ "kg-card kg-image-card\" ><img src=\ "__GHOST_URL__/content/images/size/w256h256/2022/08/[email protected]\" class=\ "kg-image\" alt=\ "\" loading=\ "lazy\" ></figure>

Ghost Version

5.75.2 local, reproduced in 5.54.0 production too

Node.js Version

16.13.0

How did you install Ghost?

Followed this guide:https://ghost.org/docs/install/local/.OS: Fedora 39

Database type

SQLite3

Browser & OS version

No response

Relevant log / error output

No response

Code of Conduct

  • I agree to be friendly and polite to people in this repository
@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label Mar 1, 2024
@daniellockyer daniellockyer added bug [triage] something behaving unexpectedly and removed needs:triage [triage] this needs to be triaged by the Ghost team labels Apr 1, 2024
@daniellockyer
Copy link
Member

Hey there, thank you so much for the bug report.

That does look like something that shouldn't happen! A PR to fix this issue would be very welcome 🙂

Copy link
Contributor

Our bot has automatically marked this issue as stale because there has not been any activity here in some time.

The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR.

We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

@github-actions github-actions bot added the stale [triage] Issues that were closed to to lack of traction label Jul 30, 2024
@github-actions github-actions bot closed this asnot planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly stale [triage] Issues that were closed to to lack of traction
Projects
None yet
Development

No branches or pull requests

2 participants