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

strings: fix Truncate behavior for formatted html #10660

Conversation

khayyamsaleem
Copy link
Contributor

@khayyamsaleem khayyamsaleem commented Jan 27, 2023

Before this fix, strings.Truncate would erroneously re-include attributes from the opening tag in the closing tag when closing formatted html, due to a bug in how tagnames were extracted from the regex capture group for html tags used in truncate.go.

This change ensures that only the tagname is retained and all attributes are discarded when storing the tags for closing them later.

Fixes #10399

Before this fix, strings.Truncate would erroneously re-include
attributes from the opening tag in the closing tag when closing
formatted html, due to a bug in how tagnames were extracted from the
regex capture group for html tags used in `truncate.go`. This change
ensures that only the tagname is retained and all attributes are discarded
when storing the tags for closing them later.

Fixes gohugoio#10399
@khayyamsaleem khayyamsaleem force-pushed the bug/truncate-formatted-html-10399 branch from 97ca7a1 to 10a8a7f Compare January 27, 2023 17:37
@bep
Copy link
Member

bep commented Mar 1, 2023

Merged in c0d15a2

@bep bep closed this Mar 1, 2023
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

truncate doesn't handle formatted HTML very well
2 participants