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

Parser incorrectly recognizes (less than) as a starting tag #1620

Open
prajal-alation opened this issue Aug 31, 2023 · 3 comments
Open

Parser incorrectly recognizes (less than) as a starting tag #1620

prajal-alation opened this issue Aug 31, 2023 · 3 comments

Comments

@prajal-alation
Copy link

Parser doesn't check if value after starting tag is a valid HTML tag or not. Parser should check if it's a valid HTML tag only then remove everything after starting tag if no closing tag found.

Taking example from : apostrophecms/sanitize-html#339

If you can find this for <$40, it's a steal! I would highly recommend getting it

after this text is run through sanitize-html which uses htmlparser2, the string is truncated to the text before the 'lt' symbol, so the remainder of the text is discarded. Is there a setting I am missing or is this a bug?

Input:
If you can find this for <$40, it's a steal! I would highly recommend getting it

Result:
If you can find this for

Expected:
If you can find this for <$40, it's a steal! I would highly recommend getting it

@fb55
Copy link
Owner

fb55 commented Sep 1, 2023

You must either be using an old version of htmlparser2, or have xmlMode enabled. Current versions of the module will skip over <$.

@prajal-alation
Copy link
Author

prajal-alation commented Sep 1, 2023

@fb55 That one works in the latest.. but have another use case where for internal DB functions considering time dimension, parser is incorrectly recognizing the tag. ( or any word after < )

Example :
event_time<current_time()

This gets trimmed down to :
event_time

Any idea on what can be a workaround for that ?

@prajal-alation
Copy link
Author

@fb55 any update on the above ?

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

No branches or pull requests

2 participants