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

Improve regex to not match empty html entities #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

denisu
Copy link

@denisu denisu commented Jan 1, 2021

Thank you for this module! I have used it to decode millions of old forum posts, it works well, but I have discovered an error with malformed html entities, specifically with &#;.

Example:

htmlEntities.decode('hello world &#;')

Leads to:

htmlentities.lua:2317: bad argument #1 to 'abs' (number expected, got string)

To solve this bug, I have changed the matching regex from * to + to match only entities with at least one occurrence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant