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

[BUG] Non string in hashtag checking #21

Closed
atrifat opened this issue Nov 30, 2023 · 0 comments · Fixed by #22
Closed

[BUG] Non string in hashtag checking #21

atrifat opened this issue Nov 30, 2023 · 0 comments · Fixed by #22

Comments

@atrifat
Copy link
Owner

atrifat commented Nov 30, 2023

Issue

The following is bug in rare or edge case when hashtag extraction fail resulting undefined (non string) item. non string cannot be processed further resulting crash in application.

Stacktrace error message:

/app/nostr-filter/nostr-util.js:41
        const tag = hashtags[index].toLowerCase();
                                    ^

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at hasNsfwHashtag (/app/nostr-filter/nostr-util.js:41:37)
    at WebSocket.<anonymous> (/app/nostr-filter/filter.js:942:78)

Solution

Wrap the implementation with String(tag) ensure that any non string value will be converted into string.

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 a pull request may close this issue.

1 participant