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]: Can pass bad dictionary values in constructor #41

Closed
1 task done
M-Scott-Lassiter opened this issue May 14, 2022 · 1 comment
Closed
1 task done

[Bug]: Can pass bad dictionary values in constructor #41

M-Scott-Lassiter opened this issue May 14, 2022 · 1 comment
Assignees
Labels
bug Something isn't working released

Comments

@M-Scott-Lassiter
Copy link
Owner

Contact Details

No response

What happened?

Although #39 fixed the issue with bad values when setting encoder.dictionary, I discovered these bad values could still get passed in the constructor function. This was because the function looked to see if the value was truthy or not:

        if (configOptions.allowLowerCaseDictionary) {
            this.allowLowerCaseDictionary = configOptions.allowLowerCaseDictionary
        }
        if (configOptions.dictionary) {
            this.dictionary = configOptions.dictionary
        }

Changing the code to make it look for if that property is contained or not should fix the issue.

        if ('allowLowerCaseDictionary' in configOptions) {
            this.allowLowerCaseDictionary = configOptions.allowLowerCaseDictionary
        }
        if ('dictionary' in configOptions) {
            this.dictionary = configOptions.dictionary
        }

Version

v1.5.1

What operating system are you seeing the problem on?

Windows

What version of Node are you seeing the problem on?

16

Relevant log output

No response

Are you able/willing to make the change? (It's ok if you're not!)

Yes

Code of Conduct

@M-Scott-Lassiter M-Scott-Lassiter added the bug Something isn't working label May 14, 2022
@M-Scott-Lassiter M-Scott-Lassiter self-assigned this May 14, 2022
github-actions bot pushed a commit that referenced this issue May 14, 2022
### [1.5.2](v1.5.1...v1.5.2) (2022-05-14)

### 🐞 Bug Fixes

* correct bug that allowed bad dictionary values to pass through the constructor ([bc6e6c7](bc6e6c7)), closes [#41](#41)
@M-Scott-Lassiter
Copy link
Owner Author

🎉 This issue has been resolved in version 1.5.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

1 participant