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

Passing non-ASCII content to Filter.clean gives a slightly cryptic TypeError #167

Open
Julian opened this issue Jun 7, 2023 · 0 comments
Assignees

Comments

@Julian
Copy link

Julian commented Jun 7, 2023

Running:

> var Filter = require('bad-words'),
...     filter = new Filter();
undefined
> filter.clean("שלום עליכם");

produces:

Uncaught TypeError: Cannot read properties of null (reading '0')
    at Filter.clean (/Users/julian/Development/library-api-v2/node_modules/.pnpm/[email protected]/node_modules/bad-words/lib/badwords.js:58:41)

where what's happening is ultimately that the \b JS regex isn't very happy with non-ASCII boundaries.

I know this library seems essentially to be for English/ASCII but perhaps it's worth considering either producing a more explicit error or perhaps returning non-ASCII input unchanged.

@web-mech web-mech self-assigned this Aug 17, 2024
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