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 validation, handle empty options.phrases #3

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

fityannugroho
Copy link
Owner

@fityannugroho fityannugroho commented Nov 18, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

Put [x] to check

  • I have read the documentation.
  • I have read and followed the Contributing Guidelines.
  • I have included a pull request description of my changes.
  • I have included the necessary changes to the documentation.
  • I have added tests to cover my changes.

PR Type

What kind of change does this PR introduce?

Please check any kind of changes that applies to this PR using [x]

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • ..... (describe the other type)

What is the current behavior?

Please describe the current behavior that you are modifying, or link to a relevant issue.

Issue Number: N/A

  • Crash when the options.phrases contains [, {, or ( item.
    Invalid regular expression: /\b[\b/: Unterminated character class
    
  • Validation for options.charSets only about the character length.
  • When options.phrases is [], the result is same with the text input (nothing changes).

What is the new behavior?

  • Tighten validation for options.phrases by only allowing alphabets, numbers, spaces, and some symbols (-_'/).
  • Tighten validation for options.charSets by only allowing alphabets for the key and prohibiting the use of control characters for the item of the value.
  • Now, options.phrases with undefined and [] are same (will obscures the whole text).

Other information

None

@fityannugroho fityannugroho changed the title Improve validation Improve validation, handle empty options.phrases Nov 18, 2023
@fityannugroho fityannugroho added the bug Something isn't working label Nov 18, 2023
@fityannugroho fityannugroho merged commit 474de8f into main Nov 18, 2023
2 checks passed
@fityannugroho fityannugroho deleted the fix/validation branch November 18, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant