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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: image preview display error when image.alt includes '<' or '>' #1113

Merged
merged 4 commits into from
Jun 28, 2023

Conversation

PENEKhun
Copy link
Contributor

Description

Describe the bug

When specifying a preview image in a post,
if you specify a value of < or > for alt, the image will not display properly because it encroaches on the HTML tag range.

To Reproduce

  1. Create a new post.
  2. In the post properties, write image.alt to contain < or >, as follows
  • example
image:
  path: /commons/devices-mockup.png
  alt: get device image -> show mockup

Expected behavior && Logs/Screenshots

  • At Home (root path)
image
  • At Post
image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (refactoring and improving code)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Additional context

How has this been tested

  • I have run bash ./tools/test (at the root of the project) locally and passed
  • I have tested this feature in the browser

Copy link
Owner

@cotes2020 cotes2020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use Jekyll's xml_escape filter.

PENEKhun and others added 2 commits June 28, 2023 15:03
… '>'

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
… '>'

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
@PENEKhun
Copy link
Contributor Author

thanks you for suggestion.

… '>'

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
@cotes2020 cotes2020 merged commit 8b0fbf5 into cotes2020:master Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants